ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, "ipp://localhost/printers/");
+
+ if ((var = cgiGetVariable("PPD_MAKE")) != NULL)
+ ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_TEXT,
+ "ppd-make", NULL, var);
+ else
+ ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
+ "requested-attributes", NULL, "ppd-make");
+
/*
* Do the request and get back a response...
*/
* Got the list of PPDs, see if the user has selected a make...
*/
- if ((var = cgiGetVariable("PPD_MAKE")) != NULL)
- {
- /*
- * Yes, copy those attributes, but check if the make doesn't
- * exist...
- */
-
- if (ippSetCGIVars(response, "ppd-make", var, NULL, 0) <= 0)
- var = NULL;
- }
+ ippSetCGIVars(response, NULL, NULL, NULL, 0);
if (var == NULL)
{
struct tm *date; /* Date information */
- DEBUG_printf(("<P>ippSetCGIVars(response=%p, filter_name=\"%s\", filter_value=\"%s\", prefix=\"%s\")\n",
- response, filter_name, filter_value, prefix));
-
+ fprintf(stderr, "DEBUG2: ippSetCGIVars(response=%p, filter_name=\"%s\", filter_value=\"%s\", prefix=\"%s\", parent_el=%d)\n",
+ response, filter_name, filter_value, prefix, parent_el);
+
/*
* Set common CGI template variables...
*/
if (!prefix)
while (attr && attr->group_tag == IPP_TAG_OPERATION)
- attr = attr->next;
+ attr = attr->next;
for (element = parent_el; attr != NULL; attr = attr->next, element ++)
{
for (filter = attr;
filter != NULL && filter->group_tag != IPP_TAG_ZERO;
filter = filter->next)
- if (filter->name && strcmp(filter->name, filter_name) == 0 &&
+ if (filter->name && !strcmp(filter->name, filter_name) &&
(filter->value_tag == IPP_TAG_STRING ||
(filter->value_tag >= IPP_TAG_TEXTLANG &&
filter->value_tag <= IPP_TAG_MIMETYPE)) &&
filter->values[0].string.text != NULL &&
- strcasecmp(filter->values[0].string.text, filter_value) == 0)
+ !strcasecmp(filter->values[0].string.text, filter_value))
break;
if (!filter)
{
cgiSetArray(name, element, value);
- DEBUG_printf(("<P>%s[%d]=\"%s\"\n", name, element, value));
+ fprintf(stderr, "DEBUG2: %s[%d]=\"%s\"\n", name, element, value);
}
}
break;
}
- DEBUG_puts("<P>Leaving ippSetCGIVars()...");
+ fprintf(stderr, "DEBUG2: Returing %d from ippSetCGIVars()...\n", element + 1);
return (element + 1);
}
* AllowIP() - Add an IP address or network that is allowed to
* access the location.
* CheckAuth() - Check authorization masks.
+ * cupsdCheckGroup() - Check for a user's group membership.
* CopyLocation() - Make a copy of a location...
* DeleteAllLocations() - Free all memory used for location authorization.
* DenyHost() - Add a host name that is not allowed to access the
*/
#include "cupsd.h"
-#include <pwd.h>
#include <grp.h>
#ifdef HAVE_SHADOW_H
# include <shadow.h>
}
+/*
+ * 'cupsdCheckGroup()' - Check for a user's group membership.
+ */
+
+int /* O - 1 if user is a member, 0 otherwise */
+cupsdCheckGroup(
+ const char *username, /* I - User name */
+ struct passwd *user, /* I - System user info */
+ const char *groupname) /* I - Group name */
+{
+ int i; /* Looping var */
+ struct group *group; /* System group info */
+ char junk[33]; /* MD5 password (not used) */
+
+
+ LogMessage(L_DEBUG2, "cupsdCheckGroup(username=\"%s\", user=%p, groupname=\"%s\")\n",
+ username, user, groupname);
+
+ /*
+ * Validate input...
+ */
+
+ if (!username || !groupname)
+ return (0);
+
+ /*
+ * Check to see if the user is a member of the named group...
+ */
+
+ group = getgrnam(groupname);
+ endgrent();
+
+ if (group != NULL)
+ {
+ /*
+ * Group exists, check it...
+ */
+
+ for (i = 0; group->gr_mem[i]; i ++)
+ if (!strcasecmp(username, group->gr_mem[i]))
+ return (1);
+ }
+
+ /*
+ * Group doesn't exist or user not in group list, check the group ID
+ * against the user's group ID...
+ */
+
+ if (user && group && group->gr_gid == user->pw_gid)
+ return (1);
+
+ /*
+ * Username not found, group not found, or user is not part of the
+ * system group... Check for a user and group in the MD5 password
+ * file...
+ */
+
+ if (GetMD5Passwd(username, groupname, junk) != NULL)
+ return (1);
+
+ /*
+ * If we get this far, then the user isn't part of the named group...
+ */
+
+ return (0);
+}
+
+
/*
* 'CopyLocation()' - Make a copy of a location...
*/
* Copy the information from the original location to the new one.
*/
- temp->limit = (*loc)->limit;
+ temp->limit = (*loc)->limit;
temp->order_type = (*loc)->order_type;
temp->type = (*loc)->type;
temp->level = (*loc)->level;
location_t *best; /* Best match for location so far */
int hostlen; /* Length of hostname */
struct passwd *pw; /* User password data */
- struct group *grp; /* Group data */
char nonce[HTTP_MAX_VALUE],
/* Nonce value from client */
md5[33], /* MD5 password */
LogMessage(L_DEBUG2, "IsAuthorized: num_names = %d", best->num_names);
for (i = 0; i < best->num_names; i ++)
- if (GetMD5Passwd(con->username, best->names[i], md5))
+ {
+ if (!strcasecmp(best->names[i], "@SYSTEM"))
+ {
+ for (j = 0; j < NumSystemGroups; j ++)
+ if (GetMD5Passwd(con->username, SystemGroups[j], md5))
+ break;
+
+ if (j < NumSystemGroups)
+ break;
+ }
+ else if (GetMD5Passwd(con->username, best->names[i], md5))
break;
+ }
if (i >= best->num_names)
md5[0] = '\0';
LogMessage(L_DEBUG2, "IsAuthorized: num_names = %d", best->num_names);
for (i = 0; i < best->num_names; i ++)
- if (GetMD5Passwd(con->username, best->names[i], md5))
+ {
+ if (!strcasecmp(best->names[i], "@SYSTEM"))
+ {
+ for (j = 0; j < NumSystemGroups; j ++)
+ if (GetMD5Passwd(con->username, SystemGroups[j], md5))
+ break;
+
+ if (j < NumSystemGroups)
+ break;
+ }
+ else if (GetMD5Passwd(con->username, best->names[i], md5))
break;
+ }
if (i >= best->num_names)
md5[0] = '\0';
*/
for (i = 0; i < best->num_names; i ++)
- if (!strcmp(con->username, best->names[i]))
+ if (!strcasecmp(con->username, best->names[i]))
return (HTTP_OK);
return (HTTP_UNAUTHORIZED);
LogMessage(L_DEBUG2, "IsAuthorized: Checking group \"%s\" membership...",
best->names[i]);
- grp = getgrnam(best->names[i]);
- endgrent();
-
- if (grp == NULL) /* No group by that name??? */
+ if (!strcasecmp(best->names[i], "@SYSTEM"))
{
- LogMessage(L_WARN, "IsAuthorized: Group \"%s\" does not exist!",
- best->names[i]);
- return (HTTP_FORBIDDEN);
+ for (j = 0; j < NumSystemGroups; j ++)
+ if (cupsdCheckGroup(con->username, pw, SystemGroups[j]))
+ return (HTTP_OK);
}
-
- for (j = 0; grp->gr_mem[j] != NULL; j ++)
- if (!strcmp(con->username, grp->gr_mem[j]))
- return (HTTP_OK);
-
- /*
- * Check to see if the default group ID matches for the user...
- */
-
- if (pw != NULL && grp->gr_gid == pw->pw_gid)
- return (HTTP_OK);
+ else if (cupsdCheckGroup(con->username, pw, best->names[i]))
+ return (HTTP_OK);
}
/*
* WWW: http://www.cups.org
*/
+/*
+ * Include necessary headers...
+ */
+
+#include <pwd.h>
+
+
/*
* HTTP authorization types and levels...
*/
unsigned netmask[4]);
extern int CheckAuth(unsigned ip[4], char *name, int namelen,
int num_masks, authmask_t *masks);
+extern int cupsdCheckGroup(const char *username,
+ struct passwd *user,
+ const char *groupname);
extern location_t *CopyLocation(location_t **loc);
extern void DeleteAllLocations(void);
extern void DenyHost(location_t *loc, char *name);
*envp[100]; /* Environment variables */
char content_length[1024], /* CONTENT_LENGTH environment variable */
content_type[1024], /* CONTENT_TYPE environment variable */
+ cups_cachedir[1024], /* CUPS_CACHEDIR environment variable */
cups_datadir[1024], /* CUPS_DATADIR environment variable */
cups_docroot[1024], /* CUPS_DOCROOT environment variable */
cups_serverbin[1024], /* CUPS_SERVERBIN environment variable */
sizeof(remote_addr) - 12);
snprintf(remote_user, sizeof(remote_user), "REMOTE_USER=%s", con->username);
snprintf(tmpdir, sizeof(tmpdir), "TMPDIR=%s", TempDir);
+ snprintf(cups_cachedir, sizeof(cups_cachedir), "CUPS_CACHEDIR=%s", CacheDir);
snprintf(cups_datadir, sizeof(cups_datadir), "CUPS_DATADIR=%s", DataDir);
snprintf(cups_docroot, sizeof(cups_docroot), "CUPS_DOCROOT=%s", DocumentRoot);
snprintf(cups_serverbin, sizeof(cups_serverbin), "CUPS_SERVERBIN=%s", ServerBin);
envp[envc ++] = lang;
envp[envc ++] = TZ;
envp[envc ++] = tmpdir;
+ envp[envc ++] = cups_cachedir;
envp[envc ++] = cups_datadir;
envp[envc ++] = cups_docroot;
envp[envc ++] = cups_serverbin;
#include "cupsd.h"
#include <stdarg.h>
-#include <pwd.h>
#include <grp.h>
#include <sys/utsname.h>
#include <cups/dir.h>
{ "BrowseShortNames", &BrowseShortNames, VAR_BOOLEAN },
{ "BrowseTimeout", &BrowseTimeout, VAR_INTEGER },
{ "Browsing", &Browsing, VAR_BOOLEAN },
+ { "CacheDir", &CacheDir, VAR_STRING },
{ "Classification", &Classification, VAR_STRING },
{ "ClassifyOverride", &ClassifyOverride, VAR_BOOLEAN },
{ "ConfigFilePerm", &ConfigFilePerm, VAR_INTEGER },
SetStringf(&ServerAdmin, "root@%s", temp);
SetString(&ServerBin, CUPS_SERVERBIN);
SetString(&RequestRoot, CUPS_REQUESTS);
- SetString(&DocumentRoot, CUPS_DOCROOT);
+ SetString(&CacheDir, CUPS_CACHEDIR);
SetString(&DataDir, CUPS_DATADIR);
+ SetString(&DocumentRoot, CUPS_DOCROOT);
SetString(&AccessLog, CUPS_LOGDIR "/access_log");
SetString(&ErrorLog, CUPS_LOGDIR "/error_log");
SetString(&PageLog, CUPS_LOGDIR "/page_log");
if (ServerBin[0] != '/')
SetStringf(&ServerBin, "%s/%s", ServerRoot, ServerBin);
+ if (StateDir[0] != '/')
+ SetStringf(&StateDir, "%s/%s", ServerRoot, StateDir);
+
+ if (CacheDir[0] != '/')
+ SetStringf(&CacheDir, "%s/%s", ServerRoot, CacheDir);
+
#ifdef HAVE_SSL
if (ServerCertificate[0] != '/')
SetStringf(&ServerCertificate, "%s/%s", ServerRoot, ServerCertificate);
* writable by the user and group in the cupsd.conf file...
*/
+ chown(CacheDir, RunUser, Group);
+ chmod(CacheDir, 0775);
+
+ snprintf(temp, sizeof(temp), "%s/ppd", CacheDir);
+ if (access(temp, 0))
+ mkdir(temp, 0755);
+ chown(temp, RunUser, Group);
+ chmod(temp, 0755);
+
chown(StateDir, RunUser, Group);
chmod(StateDir, 0775);
chown(temp, RunUser, Group);
chmod(temp, 0711);
- snprintf(temp, sizeof(temp), "%s/ppd", StateDir);
- if (access(temp, 0))
- mkdir(temp, 0755);
- chown(temp, RunUser, Group);
- chmod(temp, 0755);
-
chown(ServerRoot, RunUser, Group);
chmod(ServerRoot, 0775);
{
policy_t *p; /* New policy */
policyop_t *po; /* New policy operation */
- char groupname[255]; /* Group name */
if (DefaultPolicy)
po->order_type = POLICY_DENY;
AddPolicyOpName(po, POLICY_ALLOW, "@OWNER");
+ LogMessage(L_INFO, "Allow @OWNER");
- for (i = 0; i < NumSystemGroups; i ++)
- {
- snprintf(groupname, sizeof(groupname), "@%s", SystemGroups[i]);
- AddPolicyOpName(po, POLICY_ALLOW, groupname);
- LogMessage(L_INFO, "Allow @%s", groupname);
- }
+ AddPolicyOpName(po, POLICY_ALLOW, "@SYSTEM");
+ LogMessage(L_INFO, "Allow @SYSTEM");
AddPolicyOp(p, po, IPP_SEND_URI);
AddPolicyOp(p, po, IPP_CANCEL_JOB);
po->order_type = POLICY_DENY;
po->authenticate = 1;
- for (i = 0; i < NumSystemGroups; i ++)
- {
- snprintf(groupname, sizeof(groupname), "@%s", SystemGroups[i]);
- AddPolicyOpName(po, POLICY_ALLOW, groupname);
- LogMessage(L_INFO, "Allow @%s", groupname);
- }
+ AddPolicyOpName(po, POLICY_ALLOW, "@SYSTEM");
+ LogMessage(L_INFO, "Allow @SYSTEM");
AddPolicyOp(p, po, IPP_RESUME_PRINTER);
AddPolicyOp(p, po, IPP_SET_PRINTER_ATTRIBUTES);
char *location, /* I - Location name/path */
int linenum) /* I - Current line number */
{
- int i; /* Looping var */
location_t *loc, /* New location */
*parent; /* Parent location */
char line[HTTP_MAX_BUFFER], /* Line buffer */
{
loc->level = AUTH_GROUP;
- /*
- * Use the default system group if none is defined so far...
- */
-
- if (NumSystemGroups)
- NumSystemGroups = 1;
-
- for (i = 0; i < NumSystemGroups; i ++)
- AddName(loc, SystemGroups[i]);
+ AddName(loc, "@SYSTEM");
}
else
LogMessage(L_WARN, "Unknown authorization class %s on line %d.",
/* Error log filename */
*PageLog VALUE(NULL),
/* Page log filename */
+ *CacheDir VALUE(NULL),
+ /* Cache file directory */
*DataDir VALUE(NULL),
/* Data file directory */
*DefaultLanguage VALUE(NULL),
char *argv[]) /* I - Command-line arguments */
{
/*
- * Check the command-line...
+ * Install or list PPDs...
*/
- if (argc < 3 ||
- (!strcmp(argv[1], "cat") && argc != 3) ||
- (!strcmp(argv[1], "list") && argc != 5))
+ if (!strcmp(argv[1], "cat") && argc == 3)
+ return (cat_ppd(argv[2]));
+ else if (!strcmp(argv[1], "list") && argc == 5)
+ return (list_ppds(atoi(argv[2]), atoi(argv[3]), argv[4]));
+ else
{
fputs("Usage: cups-driverd cat ppd-name\n", stderr);
fputs("Usage: cups-driverd list request_id limit options\n", stderr);
return (1);
}
-
- /*
- * Install or list PPDs...
- */
-
- if (!strcmp(argv[1], "cat"))
- return (cat_ppd(argv[2]));
- else
- return (list_ppds(atoi(argv[2]), atoi(argv[3]), argv[4]));
}
send_name; /* Send ppd-name attribute? */
+ fprintf(stderr, "DEBUG2: [cups-driverd] list_ppds(request_id=%d, limit=%d, opt=\"%s\"\n",
+ request_id, limit, opt);
+
/*
* See if we a PPD database file...
*/
filename, NumPPDs);
}
else
- fprintf(stderr, "ERROR: [cups-driverd] Unable to write \"%s\" - %s",
+ fprintf(stderr, "ERROR: [cups-driverd] Unable to write \"%s\" - %s\n",
filename, strerror(errno));
}
else
requested = cupsGetOption("requested-attributes", num_options, options);
make = cupsGetOption("ppd-make", num_options, options);
+ fprintf(stderr, "DEBUG: [cups-driverd] requested=\"%s\"\n",
+ requested ? requested : "(nil)");
+
if (!requested || strstr(requested, "all"))
{
send_name = 1;
* Send this PPD...
*/
+ fprintf(stderr, "DEBUG: [cups-driverd] Sending %s (%s)...\n",
+ ppd->record.name, ppd->record.make_and_model);
+
count --;
cupsdSendIPPGroup(IPP_TAG_PRINTER);
*/
#include "cupsd.h"
-#include <pwd.h>
-#include <grp.h>
#ifdef HAVE_LIBPAPER
# include <paper.h>
check_quotas(client_t *con, /* I - Client connection */
printer_t *p) /* I - Printer or class */
{
- int i, j; /* Looping vars */
+ int i; /* Looping var */
ipp_attribute_t *attr; /* Current attribute */
char username[33]; /* Username */
quota_t *q; /* Quota data */
struct passwd *pw; /* User password data */
- struct group *grp; /* Group data */
LogMessage(L_DEBUG2, "check_quotas(%p[%d], %p[%s])\n",
* Check group membership...
*/
- grp = getgrnam(p->users[i] + 1);
- endgrent();
-
- if (grp)
- {
- /*
- * Check primary group...
- */
-
- if (pw && grp->gr_gid == pw->pw_gid)
- break;
-
- /*
- * Check usernames in group...
- */
-
- for (j = 0; grp->gr_mem[j]; j ++)
- if (!strcasecmp(username, grp->gr_mem[j]))
- break;
-
- if (grp->gr_mem[j])
- break;
- }
+ if (cupsdCheckGroup(username, pw, p->users[i] + 1))
+ break;
}
else if (!strcasecmp(username, p->users[i]))
break;
*/
limit = ippFindAttribute(con->request, "limit", IPP_TAG_INTEGER);
- make = ippFindAttribute(con->request, "ppd-make", IPP_TAG_KEYWORD);
+ make = ippFindAttribute(con->request, "ppd-make", IPP_TAG_TEXT);
requested = ippFindAttribute(con->request, "requested-attributes",
IPP_TAG_KEYWORD);
snprintf(command, sizeof(command), "%s/daemon/cups-driverd", ServerBin);
snprintf(options, sizeof(options),
- "cups-driverd %d+%d+requested-attributes=%s%s%s",
+ "cups-driverd list+%d+%d+requested-attributes=%s%s%s",
con->request->request.op.request_id,
limit ? limit->values[0].integer : 0,
attrs,
- make ? " ppd-make=" : "",
+ make ? "%20ppd-make=" : "",
make ? make->values[0].string.text : "");
if (SendCommand(con, command, options, 0))
user_allowed(printer_t *p, /* I - Printer or class */
const char *username) /* I - Username */
{
- int i, j; /* Looping vars */
+ int i; /* Looping var */
struct passwd *pw; /* User password data */
- struct group *grp; /* Group data */
if (p->num_users == 0)
* Check group membership...
*/
- grp = getgrnam(p->users[i] + 1);
- endgrent();
-
- if (grp)
- {
- /*
- * Check primary group...
- */
-
- if (pw && grp->gr_gid == pw->pw_gid)
- break;
-
- /*
- * Check usernames in group...
- */
-
- for (j = 0; grp->gr_mem[j]; j ++)
- if (!strcasecmp(username, grp->gr_mem[j]))
- break;
-
- if (grp->gr_mem[j])
- break;
- }
+ if (cupsdCheckGroup(username, pw, p->users[i] + 1))
+ break;
}
else if (!strcasecmp(username, p->users[i]))
break;
ppd[1024], /* PPD environment variable */
class_name[255], /* CLASS environment variable */
printer_name[255], /* PRINTER environment variable */
+ cups_cachedir[1024], /* CUPS_CACHEDIR environment variable */
cups_datadir[1024], /* CUPS_DATADIR environment variable */
cups_docroot[1024], /* CUPS_DOCROOT environment variable */
cups_fontpath[1024], /* CUPS_FONTPATH environment variable */
snprintf(ppd, sizeof(ppd), "PPD=%s/ppd/%s.ppd", ServerRoot, printer->name);
snprintf(printer_name, sizeof(printer_name), "PRINTER=%s", printer->name);
snprintf(cache, sizeof(cache), "RIP_MAX_CACHE=%s", RIPCache);
+ snprintf(cups_cachedir, sizeof(cups_cachedir), "CUPS_CACHEDIR=%s", CacheDir);
snprintf(cups_datadir, sizeof(cups_datadir), "CUPS_DATADIR=%s", DataDir);
snprintf(cups_docroot, sizeof(cups_docroot), "CUPS_DOCROOT=%s", DocumentRoot);
snprintf(cups_fontpath, sizeof(cups_fontpath), "CUPS_FONTPATH=%s", FontPath);
if (TZ && TZ[0])
envp[envc ++] = TZ;
envp[envc ++] = ppd;
+ envp[envc ++] = cups_cachedir;
envp[envc ++] = cups_datadir;
envp[envc ++] = cups_docroot;
envp[envc ++] = cups_fontpath;
*/
#include "cupsd.h"
-#include <pwd.h>
#include <grp.h>
#ifdef HAVE_USERSEC_H
# include <usersec.h>
* Local functions...
*/
-static int check_group(const char *name, const char *group);
static int check_op(policyop_t *po, int allow_deny, const char *name,
const char *owner);
}
-/*
- * 'validate_user()' - Validate the user for the request.
- */
-
-static int /* O - 1 if permitted, 0 otherwise */
-check_group(const char *username, /* I - Authenticated username */
- const char *groupname) /* I - Group name */
-{
- int i; /* Looping var */
- struct passwd *user; /* User info */
- struct group *group; /* System group info */
- char junk[33]; /* MD5 password (not used) */
-
-
- LogMessage(L_DEBUG2, "check_group(%s, %s)\n", username, groupname);
-
- /*
- * Validate input...
- */
-
- if (!username || !groupname)
- return (0);
-
- /*
- * Check to see if the user is a member of the named group...
- */
-
- user = getpwnam(username);
- endpwent();
-
- group = getgrnam(groupname);
- endgrent();
-
- if (group != NULL)
- {
- /*
- * Group exists, check it...
- */
-
- for (i = 0; group->gr_mem[i]; i ++)
- if (!strcasecmp(username, group->gr_mem[i]))
- return (1);
- }
-
- /*
- * Group doesn't exist or user not in group list, check the group ID
- * against the user's group ID...
- */
-
- if (user && group && group->gr_gid == user->pw_gid)
- return (1);
-
- /*
- * Username not found, group not found, or user is not part of the
- * system group... Check for a user and group in the MD5 password
- * file...
- */
-
- if (GetMD5Passwd(username, groupname, junk) != NULL)
- return (1);
-
- /*
- * If we get this far, then the user isn't part of the named group...
- */
-
- return (0);
-
-
-#if 0 //// OLD OLD OLD OLD OLD
- if (strcasecmp(username, owner) != 0 && strcasecmp(username, "root") != 0)
- {
- /*
- * Not the owner or root; check to see if the user is a member of the
- * system group...
- */
-
- user = getpwnam(username);
- endpwent();
-
- for (i = 0, j = 0, group = NULL; i < NumSystemGroups; i ++)
- {
- group = getgrnam(SystemGroups[i]);
- endgrent();
-
- if (group != NULL)
- {
- for (j = 0; group->gr_mem[j]; j ++)
- if (strcasecmp(username, group->gr_mem[j]) == 0)
- break;
-
- if (group->gr_mem[j])
- break;
- }
- else
- j = 0;
- }
-
- if (user == NULL || group == NULL ||
- (group->gr_mem[j] == NULL && group->gr_gid != user->pw_gid))
- {
- /*
- * Username not found, group not found, or user is not part of the
- * system group... Check for a user and group in the MD5 password
- * file...
- */
-
- for (i = 0; i < NumSystemGroups; i ++)
- if (GetMD5Passwd(username, SystemGroups[i], junk) != NULL)
- return (1);
-
- /*
- * Nope, not an MD5 user, either. Return 0 indicating no-go...
- */
-
- return (0);
- }
- }
-
- return (1);
-#endif //// 0
-}
-
-
/*
* 'check_op()' - Check the current operation.
*/
const char *name, /* I - User name */
const char *owner) /* I - Owner name */
{
- int i; /* Looping vars */
+ int i, j; /* Looping vars */
policyname_t *pn; /* Current policy name */
+ struct passwd *pw; /* User's password entry */
+ pw = getpwnam(name);
+ endpwent();
+
for (i = po->num_names, pn = po->names; i > 0; i --, pn ++)
{
if (pn->allow_deny != allow_deny)
if (owner && !strcasecmp(name, owner))
return (1);
}
+ else if (!strcasecmp(pn->name, "@SYSTEM"))
+ {
+ for (j = 0; j < NumSystemGroups; j ++)
+ if (cupsdCheckGroup(name, pw, SystemGroups[j]))
+ return (1);
+ }
else if (pn->name[0] == '@')
{
- if (check_group(name, pn->name + 1))
+ if (cupsdCheckGroup(name, pw, pn->name + 1))
return (1);
}
else if (!strcasecmp(name, pn->name))
{
/*
* Send IPP/1.1 response header: version number (2 bytes), status code
- * (4 bytes), and request ID (4 bytes)...
+ * (2 bytes), and request ID (4 bytes)...
*/
putchar(1);
putchar(1);
- putchar(status_code >> 24);
- putchar(status_code >> 16);
putchar(status_code >> 8);
putchar(status_code);
ServerRoot /tmp/$user
StateDir /tmp/$user
ServerBin /tmp/$user/bin
+CacheDir /tmp/$user/share
DataDir /tmp/$user/share
FontPath /tmp/$user/share/fonts
DocumentRoot $root/doc