=== modified file 'cups/auth.c' --- cups/auth.c 2008-07-11 21:46:21 +0000 +++ cups/auth.c 2008-09-25 00:48:17 +0000 @@ -154,8 +154,13 @@ "Digest", 5) != 0; http->userpass[0] = '\0'; - if ((password = cupsGetPassword(prompt)) == NULL) - return (-1); + if (http->password_cb != NULL) { + if ((password = http->password_cb(http, prompt)) == NULL) + return (-1); + } else { + if ((password = cupsGetPassword(prompt)) == NULL) + return (-1); + } if (!password[0]) return (-1); === modified file 'cups/http-private.h' --- cups/http-private.h 2008-08-19 23:07:25 +0000 +++ cups/http-private.h 2008-09-25 01:03:51 +0000 @@ -130,7 +130,6 @@ size_t *dataLength); # endif /* HAVE_LIBSSL */ - struct _http_s /**** HTTP connection structure. ****/ { int fd; /* File descriptor for this socket */ @@ -188,6 +187,8 @@ # ifdef HAVE_AUTHORIZATION_H AuthorizationRef auth_ref; /* Authorization ref */ # endif /* HAVE_AUTHORIZATION_H */ + http_password_cb_t password_cb; + /* Connection-specific password callback */ }; === modified file 'cups/http.c' --- cups/http.c 2008-08-19 23:07:25 +0000 +++ cups/http.c 2008-09-25 01:02:32 +0000 @@ -3279,6 +3279,11 @@ } #endif /* HAVE_SSL */ +void +httpSetPasswordCB(http_t *http, http_password_cb_t cb) +{ + http->password_cb = cb; +} /* * End of "$Id$". === modified file 'cups/http.h' --- cups/http.h 2007-10-18 23:57:45 +0000 +++ cups/http.h 2008-09-25 01:02:02 +0000 @@ -314,6 +314,8 @@ typedef struct _http_s http_t; /**** HTTP connection type ****/ +/**** Password callback ****/ +typedef const char *(*http_password_cb_t)(http_t *http, const char *prompt); /* * Prototypes... @@ -437,6 +439,8 @@ extern void httpSetAuthString(http_t *http, const char *scheme, const char *data) _CUPS_API_1_3; +extern void httpSetPasswordCB(http_t *http, http_password_cb_t cb); + /* * C++ magic... */