diff -Naur cups-1.2.1.old/cups/usersys.c cups-1.2.1/cups/usersys.c --- cups-1.2.1.old/cups/usersys.c 2006-02-26 07:10:27 +0300 +++ cups-1.2.1/cups/usersys.c 2006-05-24 16:23:57 +0400 @@ -162,6 +162,26 @@ _cupsGlobals()->encryption = e; } +static +int socket_access(const char* name) +{ + struct sockaddr_un s_un; + int sock = -1; + int ret = 0; + + bzero(&s_un, sizeof(s_un)); + + strncpy(s_un.sun_path, name,sizeof s_un.sun_path); + s_un.sun_family = AF_UNIX; + + if (((sock = socket(AF_UNIX, SOCK_STREAM, 0)) > 0) && + (connect(sock, (struct sockaddr *)&s_un,SUN_LEN(&s_un)) == 0)) + ret = 1; + + if (sock >= 0) close(sock); + return ret; +} + /* * 'cupsServer()' - Return the hostname/address of the default server. @@ -209,8 +229,9 @@ * domain socket if it exists and has the right permissions... */ - if (!stat(CUPS_DEFAULT_DOMAINSOCKET, &sockinfo) && - (sockinfo.st_mode & S_IRWXO) == S_IRWXO) +// if (!stat(CUPS_DEFAULT_DOMAINSOCKET, &sockinfo) && +// (sockinfo.st_mode & S_IRWXO) == S_IRWXO) + if (socket_access(CUPS_DEFAULT_DOMAINSOCKET)) server = CUPS_DEFAULT_DOMAINSOCKET; else #endif /* CUPS_DEFAULT_DOMAINSOCKET */ diff -Naur cups-1.2.1.old/scheduler/listen.c cups-1.2.1/scheduler/listen.c --- cups-1.2.1.old/scheduler/listen.c 2006-02-06 05:57:43 +0300 +++ cups-1.2.1/scheduler/listen.c 2006-05-24 16:25:37 +0400 @@ -320,7 +320,12 @@ cupsdLogMessage(CUPSD_LOG_INFO, "Listening to %s on fd %d...", s, lis->fd); - if (chmod(s, 0140777)) +// if (chmod(s, 0140777)) + if (chmod(s, 0770)) + cupsdLogMessage(CUPSD_LOG_ERROR, + "Unable to change permisssions on domain socket " + "\"%s\" - %s", s, strerror(errno)); + if (chown(s, 0,Group)) cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to change permisssions on domain socket " "\"%s\" - %s", s, strerror(errno));