MCPcopy Create free account
hub / github.com/OpenPrinting/cups / validate_user

Function validate_user

scheduler/ipp.c:11875–11908  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11873 */
11874
11875static int /* O - 1 if permitted, 0 otherwise */
11876validate_user(cupsd_job_t *job, /* I - Job */
11877 cupsd_client_t *con, /* I - Client connection */
11878 const char *owner, /* I - Owner of job/resource */
11879 char *username, /* O - Authenticated username */
11880 size_t userlen) /* I - Length of username */
11881{
11882 cupsd_printer_t *printer; /* Printer for job */
11883
11884
11885 cupsdLogMessage(CUPSD_LOG_DEBUG2, "validate_user(job=%d, con=%d, owner=\"%s\", username=%p, userlen=" CUPS_LLFMT ")", job->id, con ? con->number : 0, owner ? owner : "(null)", (void *)username, CUPS_LLCAST userlen);
11886
11887 /*
11888 * Validate input...
11889 */
11890
11891 if (!con || !owner || !username || userlen <= 0)
11892 return (0);
11893
11894 /*
11895 * Get the best authenticated username that is available.
11896 */
11897
11898 strlcpy(username, get_username(con), userlen);
11899
11900 /*
11901 * Check the username against the owner...
11902 */
11903
11904 printer = cupsdFindDest(job->dest);
11905
11906 return (cupsdCheckPolicy(printer ? printer->op_policy_ptr : DefaultPolicyPtr,
11907 con, owner) == HTTP_OK);
11908}

Callers 9

authenticate_jobFunction · 0.85
cancel_jobFunction · 0.85
close_jobFunction · 0.85
hold_jobFunction · 0.85
move_jobFunction · 0.85
release_jobFunction · 0.85
restart_jobFunction · 0.85
send_documentFunction · 0.85
set_job_attrsFunction · 0.85

Calls 4

cupsdLogMessageFunction · 0.85
get_usernameFunction · 0.85
cupsdFindDestFunction · 0.85
cupsdCheckPolicyFunction · 0.85

Tested by

no test coverage detected