]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/usersys.c
Load cups into easysw/current.
[thirdparty/cups.git] / cups / usersys.c
index 1b73cbdae3734a42aa241ad1b283b9e39548f783..cb25863f34f32acfdc12aad34d9210820b87ddf8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: usersys.c 4918 2006-01-12 05:14:40Z mike $"
+ * "$Id: usersys.c 5041 2006-02-01 16:54:50Z mike $"
  *
  *   User, system, and password routines for the Common UNIX Printing
  *   System (CUPS).
@@ -44,6 +44,7 @@
 #include "http-private.h"
 #include "globals.h"
 #include <stdlib.h>
+#include <sys/stat.h>
 #ifdef WIN32
 #  include <windows.h>
 #endif /* WIN32 */
@@ -184,6 +185,9 @@ cupsServer(void)
   char         line[1024],             /* Line from file */
                *value;                 /* Value on line */
   int          linenum;                /* Line number in file */
+#ifdef CUPS_DEFAULT_DOMAINSOCKET
+  struct stat  sockinfo;               /* Domain socket information */
+#endif /* CUPS_DEFAULT_DOMAINSOCKET */
   _cups_globals_t *cg = _cupsGlobals();        /* Pointer to library globals */
 
 
@@ -218,7 +222,13 @@ cupsServer(void)
       }
 
 #ifdef CUPS_DEFAULT_DOMAINSOCKET
-      if (!access(CUPS_DEFAULT_DOMAINSOCKET, 0))
+     /*
+      * If we are compiled with domain socket support, only use the
+      * domain socket if it exists and has the right permissions...
+      */
+
+      if (!stat(CUPS_DEFAULT_DOMAINSOCKET, &sockinfo) &&
+          (sockinfo.st_mode & S_IRWXO) == S_IRWXO)
         server = CUPS_DEFAULT_DOMAINSOCKET;
       else
 #endif /* CUPS_DEFAULT_DOMAINSOCKET */
@@ -459,5 +469,5 @@ _cupsGetPassword(const char *prompt)        /* I - Prompt string */
 
 
 /*
- * End of "$Id: usersys.c 4918 2006-01-12 05:14:40Z mike $".
+ * End of "$Id: usersys.c 5041 2006-02-01 16:54:50Z mike $".
  */