/*
- * "$Id$"
- *
* Client routines for the CUPS scheduler.
*
* Copyright 2007-2015 by Apple Inc.
* Save the connected address and port number...
*/
- con->clientaddr = lis->address;
+ addrlen = sizeof(con->clientaddr);
+
+ if (getsockname(httpGetFd(con->http), (struct sockaddr *)&con->clientaddr, &addrlen) || addrlen == 0)
+ con->clientaddr = lis->address;
+
+ cupsdLogClient(con, CUPSD_LOG_DEBUG, "Server address is \"%s\".", httpAddrString(&con->clientaddr, name, sizeof(name)));
/*
* Check the number of clients on the same address...
break;
}
}
- else if (!WebInterface)
- {
- /*
- * Web interface is disabled. Show an appropriate message...
- */
-
- if (!cupsdSendError(con, HTTP_STATUS_CUPS_WEBIF_DISABLED, CUPSD_AUTH_NONE))
- {
- cupsdCloseClient(con);
- return;
- }
-
- break;
- }
- if ((!strncmp(con->uri, "/admin", 6) &&
- strncmp(con->uri, "/admin/conf/", 12) &&
- strncmp(con->uri, "/admin/log/", 11)) ||
+ if ((!strncmp(con->uri, "/admin", 6) && strcmp(con->uri, "/admin/conf/cupsd.conf") && strncmp(con->uri, "/admin/log/", 11)) ||
!strncmp(con->uri, "/printers", 9) ||
!strncmp(con->uri, "/classes", 8) ||
!strncmp(con->uri, "/help", 5) ||
!strncmp(con->uri, "/jobs", 5))
{
+ if (!WebInterface)
+ {
+ /*
+ * Web interface is disabled. Show an appropriate message...
+ */
+
+ if (!cupsdSendError(con, HTTP_STATUS_CUPS_WEBIF_DISABLED, CUPSD_AUTH_NONE))
+ {
+ cupsdCloseClient(con);
+ return;
+ }
+
+ break;
+ }
+
/*
* Send CGI output...
*/
if (httpGetVersion(con->http) <= HTTP_VERSION_1_0)
httpSetKeepAlive(con->http, HTTP_KEEPALIVE_OFF);
}
- else if ((!strncmp(con->uri, "/admin/conf/", 12) &&
- (strchr(con->uri + 12, '/') ||
- strlen(con->uri) == 12)) ||
- (!strncmp(con->uri, "/admin/log/", 11) &&
- (strchr(con->uri + 11, '/') ||
- strlen(con->uri) == 11)))
+ else if (!strncmp(con->uri, "/admin/log/", 11) && (strchr(con->uri + 11, '/') || strlen(con->uri) == 11))
{
/*
* GET can only be done to configuration files directly under
* /admin/conf...
*/
- cupsdLogClient(con, CUPSD_LOG_ERROR,
- "Request for subdirectory \"%s\"!", con->uri);
+ cupsdLogClient(con, CUPSD_LOG_ERROR, "Request for subdirectory \"%s\".", con->uri);
if (!cupsdSendError(con, HTTP_STATUS_FORBIDDEN, CUPSD_AUTH_NONE))
{
break;
}
- else if ((!strncmp(con->uri, "/admin", 6) &&
- strncmp(con->uri, "/admin/conf/", 12) &&
- strncmp(con->uri, "/admin/log/", 11)) ||
+ else if ((!strncmp(con->uri, "/admin", 6) && strncmp(con->uri, "/admin/log/", 11)) ||
!strncmp(con->uri, "/printers", 9) ||
!strncmp(con->uri, "/classes", 8) ||
!strncmp(con->uri, "/help", 5) ||
break;
}
- if ((!strncmp(con->uri, "/admin", 6) &&
- strncmp(con->uri, "/admin/conf/", 12) &&
- strncmp(con->uri, "/admin/log/", 11)) ||
+ if ((!strncmp(con->uri, "/admin", 6) && strcmp(con->uri, "/admin/conf/cupsd.conf") && strncmp(con->uri, "/admin/log/", 11)) ||
!strncmp(con->uri, "/printers", 9) ||
!strncmp(con->uri, "/classes", 8) ||
!strncmp(con->uri, "/help", 5) ||
cupsdLogRequest(con, HTTP_STATUS_OK);
}
- else if ((!strncmp(con->uri, "/admin/conf/", 12) &&
- (strchr(con->uri + 12, '/') ||
- strlen(con->uri) == 12)) ||
- (!strncmp(con->uri, "/admin/log/", 11) &&
- (strchr(con->uri + 11, '/') ||
- strlen(con->uri) == 11)))
+ else if (!strncmp(con->uri, "/admin/log/", 11) && (strchr(con->uri + 11, '/') || strlen(con->uri) == 11))
{
/*
* HEAD can only be done to configuration files under
cupsdLogClient(con, CUPSD_LOG_DEBUG, "CGI data ready to be sent.");
}
-
-
-/*
- * End of "$Id$".
- */