diff --git a/cgi-bin/admin.c b/cgi-bin/admin.c index e0f1136..02ff51d 100644 --- a/cgi-bin/admin.c +++ b/cgi-bin/admin.c @@ -636,7 +636,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */ }; - ptr = cgiGetTextfield("DEVICE_URI"); + ptr = cgiGetVariable("DEVICE_URI"); fprintf(stderr, "DEBUG: do_am_printer: DEVICE_URI=\"%s\"\n", ptr ? ptr : "(null)"); @@ -697,7 +697,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */ } } - if ((var = cgiGetTextfield("DEVICE_URI")) != NULL) + if ((var = cgiGetVariable("DEVICE_URI")) != NULL) { if ((uriptr = strrchr(var, '|')) != NULL) { @@ -1130,7 +1130,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */ ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_TEXT, "printer-info", NULL, cgiGetTextfield("PRINTER_INFO")); - strlcpy(uri, cgiGetTextfield("DEVICE_URI"), sizeof(uri)); + strlcpy(uri, cgiGetVariable("DEVICE_URI"), sizeof(uri)); /* * Strip make and model from URI... diff --git a/cgi-bin/var.c b/cgi-bin/var.c index 6ad945d..a4993ff 100644 --- a/cgi-bin/var.c +++ b/cgi-bin/var.c @@ -288,7 +288,7 @@ cgiGetTextfield(const char *name) /* I - Name of form field */ value = NULL; } - return (value); + return (value ? strdup(value) : NULL); }