diff options
Diffstat (limited to 'scheduler/ipp.c')
-rw-r--r-- | scheduler/ipp.c | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/scheduler/ipp.c b/scheduler/ipp.c index b1380885..fa3d96ea 100644 --- a/scheduler/ipp.c +++ b/scheduler/ipp.c @@ -1,5 +1,5 @@ /* - * "$Id: ipp.c 10112 2011-11-07 06:08:44Z mike $" + * "$Id: ipp.c 10274 2012-02-13 20:42:51Z mike $" * * IPP routines for the CUPS scheduler. * @@ -4106,7 +4106,6 @@ authenticate_job(cupsd_client_t *con, /* I - Client connection */ { cupsd_printer_t *printer; /* Job destination */ - /* * No auth data. If we need to authenticate via Kerberos, send a * HTTP auth challenge, otherwise just return an IPP error... @@ -10363,6 +10362,8 @@ save_auth_info( fchown(cupsFileNumber(fp), 0, 0); fchmod(cupsFileNumber(fp), 0400); + cupsFilePuts(fp, "CUPSD-AUTH-V2\n"); + for (i = 0; i < (int)(sizeof(job->auth_env) / sizeof(job->auth_env[0])); i ++) @@ -10381,7 +10382,7 @@ save_auth_info( { httpEncode64_2(line, sizeof(line), auth_info->values[i].string.text, strlen(auth_info->values[i].string.text)); - cupsFilePrintf(fp, "%s\n", line); + cupsFilePutConf(fp, dest->auth_info_required[i], line); if (!strcmp(dest->auth_info_required[i], "username")) cupsdSetStringf(job->auth_env + i, "AUTH_USERNAME=%s", @@ -10396,11 +10397,31 @@ save_auth_info( cupsdSetStringf(job->auth_env + i, "AUTH_NEGOTIATE=%s", auth_info->values[i].string.text); else - cupsdSetStringf(job->auth_env + i, "AUTH_%s=%s", - dest->auth_info_required[i], - auth_info->values[i].string.text); + i --; } } + else if (auth_info && auth_info->num_values == 2 && + dest->num_auth_info_required == 1 && + !strcmp(dest->auth_info_required[0], "negotiate")) + { + /* + * Allow fallback to username+password for Kerberized queues... + */ + + httpEncode64_2(line, sizeof(line), auth_info->values[0].string.text, + strlen(auth_info->values[0].string.text)); + cupsFilePutConf(fp, "username", line); + + cupsdSetStringf(job->auth_env + 0, "AUTH_USERNAME=%s", + auth_info->values[0].string.text); + + httpEncode64_2(line, sizeof(line), auth_info->values[1].string.text, + strlen(auth_info->values[1].string.text)); + cupsFilePutConf(fp, "password", line); + + cupsdSetStringf(job->auth_env + 1, "AUTH_PASSWORD=%s", + auth_info->values[1].string.text); + } else if (con->username[0]) { /* @@ -10408,7 +10429,7 @@ save_auth_info( */ httpEncode64_2(line, sizeof(line), con->username, strlen(con->username)); - cupsFilePrintf(fp, "%s\n", line); + cupsFilePutConf(fp, "username", line); cupsdSetStringf(job->auth_env + 0, "AUTH_USERNAME=%s", con->username); @@ -10417,7 +10438,7 @@ save_auth_info( */ httpEncode64_2(line, sizeof(line), con->password, strlen(con->password)); - cupsFilePrintf(fp, "%s\n", line); + cupsFilePutConf(fp, "password", line); cupsdSetStringf(job->auth_env + 1, "AUTH_PASSWORD=%s", con->password); } @@ -10425,7 +10446,7 @@ save_auth_info( #ifdef HAVE_GSSAPI if (con->gss_uid > 0) { - cupsFilePrintf(fp, "%d\n", (int)con->gss_uid); + cupsFilePrintf(fp, "uid %d\n", (int)con->gss_uid); cupsdSetStringf(&job->auth_uid, "AUTH_UID=%d", (int)con->gss_uid); } #endif /* HAVE_GSSAPI */ @@ -12278,5 +12299,5 @@ validate_user(cupsd_job_t *job, /* I - Job */ /* - * End of "$Id: ipp.c 10112 2011-11-07 06:08:44Z mike $". + * End of "$Id: ipp.c 10274 2012-02-13 20:42:51Z mike $". */ |