Skip to content

Commit 429756f

Browse files
authored
Merge commit from fork
Block authentication using alternate method.
2 parents 360229b + 2f70033 commit 429756f

1 file changed

Lines changed: 30 additions & 1 deletion

File tree

scheduler/auth.c

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,16 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
576576

577577
int userlen; /* Username:password length */
578578

579+
/*
580+
* Only allow Basic if enabled...
581+
*/
582+
583+
if (type != CUPSD_AUTH_BASIC)
584+
{
585+
cupsdLogClient(con, CUPSD_LOG_ERROR, "Basic authentication is not enabled.");
586+
return;
587+
}
588+
579589
authorization += 5;
580590
while (isspace(*authorization & 255))
581591
authorization ++;
@@ -621,7 +631,6 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
621631
* Validate the username and password...
622632
*/
623633

624-
if (type == CUPSD_AUTH_BASIC)
625634
{
626635
#if HAVE_LIBPAM
627636
/*
@@ -715,6 +724,16 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
715724
*name, // Real name
716725
*email; // Email address
717726

727+
/*
728+
* Only allow OAuth if enabled...
729+
*/
730+
731+
if (type != CUPSD_AUTH_BEARER)
732+
{
733+
cupsdLogClient(con, CUPSD_LOG_ERROR, "OAuth authentication is not enabled.");
734+
return;
735+
}
736+
718737
// Skip whitespace after "Bearer"...
719738
authorization += 7;
720739
while (isspace(*authorization & 255))
@@ -768,6 +787,16 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
768787
/* Output token for username */
769788
gss_name_t client_name; /* Client name */
770789

790+
/*
791+
* Only allow Kerberos if enabled...
792+
*/
793+
794+
if (type != CUPSD_AUTH_NEGOTIATE)
795+
{
796+
cupsdLogClient(con, CUPSD_LOG_ERROR, "Kerberos authentication is not enabled.");
797+
return;
798+
}
799+
771800
# ifdef __APPLE__DISABLED // Remove DISABLED if ever this code is used for macOS installer
772801
/*
773802
* If the weak-linked GSSAPI/Kerberos library is not present, don't try

0 commit comments

Comments
 (0)