mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 15:05:23 +00:00
Use isc_base64_decodestring() instead of explicitly creating a lexer.
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: nsupdate.c,v 1.29 2000/07/09 16:17:13 tale Exp $ */
|
/* $Id: nsupdate.c,v 1.30 2000/07/17 17:42:54 bwelling Exp $ */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
@@ -248,8 +248,6 @@ setup_key() {
|
|||||||
if (keystr != NULL) {
|
if (keystr != NULL) {
|
||||||
isc_buffer_t keynamesrc;
|
isc_buffer_t keynamesrc;
|
||||||
char *secretstr;
|
char *secretstr;
|
||||||
isc_buffer_t secretsrc;
|
|
||||||
isc_lex_t *lex = NULL;
|
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
debug("Creating key...");
|
debug("Creating key...");
|
||||||
@@ -275,27 +273,16 @@ setup_key() {
|
|||||||
if (secret == NULL)
|
if (secret == NULL)
|
||||||
fatal("out of memory");
|
fatal("out of memory");
|
||||||
|
|
||||||
isc_buffer_init(&secretsrc, secretstr, strlen(secretstr));
|
|
||||||
isc_buffer_add(&secretsrc, strlen(secretstr));
|
|
||||||
|
|
||||||
isc_buffer_init(&secretbuf, secret, secretlen);
|
isc_buffer_init(&secretbuf, secret, secretlen);
|
||||||
|
result = isc_base64_decodestring(mctx, secretstr, &secretbuf);
|
||||||
result = isc_lex_create(mctx, strlen(secretstr), &lex);
|
|
||||||
check_result(result, "isc_lex_create");
|
|
||||||
result = isc_lex_openbuffer(lex, &secretsrc);
|
|
||||||
check_result(result, "isc_lex_openbuffer");
|
|
||||||
result = isc_base64_tobuffer(lex, &secretbuf, -1);
|
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
fprintf(stderr, "Couldn't create key from %s: %s\n",
|
fprintf(stderr, "Couldn't create key from %s: %s\n",
|
||||||
keystr, isc_result_totext(result));
|
keystr, isc_result_totext(result));
|
||||||
isc_lex_close(lex);
|
|
||||||
isc_lex_destroy(&lex);
|
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
secretlen = isc_buffer_usedlength(&secretbuf);
|
secretlen = isc_buffer_usedlength(&secretbuf);
|
||||||
debug("close");
|
debug("close");
|
||||||
isc_lex_close(lex);
|
|
||||||
isc_lex_destroy(&lex);
|
|
||||||
} else {
|
} else {
|
||||||
dst_key_t *dstkey = NULL;
|
dst_key_t *dstkey = NULL;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user