Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Support for setting per-connection password callback #2953
Libraries like GTK+ need the ability to set the password callback for a specific http connection, without side-effects that influence whatever application they're loaded into (the application may construct CUPS connections on its own and want to provide a different callback).
The attached patch adds a per-http-connection password callback function that will be used if set. If no per-connection password callback is set, the behaviour is as previously.
CUPS.org User: mike
OK, added the following APIs:
typedef const char _(_cups_password_cb2_t)(const char *prompt, http_t *http, const char *method, const char *resource, void *user_data);
extern const char *cupsGetPassword2(const char *prompt, http_t *http, const char *method, const char *resource);
The callback is still per-thread, but the connection is passed as one of the arguments (along with other necessary information...)
=== modified file 'cups/auth.c'
=== modified file 'cups/http-private.h'
endif /_ HAVE_LIBSSL */
struct http_s /**** HTTP connection structure. ***/
AuthorizationRef auth_ref; /_ Authorization ref _/
endif /_ HAVE_AUTHORIZATION_H */
=== modified file 'cups/http.c'
=== modified file 'cups/http.h'
typedef struct _http_s http_t; /**** HTTP connection type ****/
+/**** Password callback ***_/
+extern void httpSetPasswordCB(http_t http, http_password_cb_t cb);
--- cups/auth.c (revision 8566)
int /* O - 0 on success, -1 on error /
--- cups/usersys.c (revision 8566)
--- cups/cups.h (revision 8566)
+typedef const char _(_cups_password_cb2_t)(const char *prompt, http_t *http,
--- cups/globals.h (revision 8566)
/* util.c /