]> git.sur5r.net Git - openldap/commitdiff
Do a mkdir on /var/run/nslcd before trying to create the socket
authorHoward Chu <hyc@openldap.org>
Wed, 3 Jun 2009 02:20:56 +0000 (02:20 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 3 Jun 2009 02:20:56 +0000 (02:20 +0000)
contrib/slapd-modules/nssov/nssov.c
contrib/slapd-modules/nssov/nssov.h

index 65f736e7a970ef68f67db1402afbc9b097bc5189..08f318d65e578eef354af8c1e616c15d27284fbd 100644 (file)
@@ -800,16 +800,24 @@ nssov_db_open(
                }
        }
        if ( slapMode & SLAP_SERVER_MODE ) {
+               /* make sure /var/run/nslcd exists */
+               if (mkdir(NSLCD_PATH, (mode_t) 0555)) {
+                       Debug(LDAP_DEBUG_TRACE,"nssov: mkdir(%s) failed (ignored): %s\n",
+                                       NSLCD_PATH,strerror(errno),0);
+               } else {
+                       Debug(LDAP_DEBUG_TRACE,"nssov: created %s\n",NSLCD_PATH,0,0);
+               }
+
                /* create a socket */
                if ( (sock=socket(PF_UNIX,SOCK_STREAM,0))<0 )
                {
-                       Debug(LDAP_DEBUG_ANY,"nssov: cannot create socket: %s",strerror(errno),0,0);
+                       Debug(LDAP_DEBUG_ANY,"nssov: cannot create socket: %s\n",strerror(errno),0,0);
                        return -1;
                }
                /* remove existing named socket */
                if (unlink(NSLCD_SOCKET)<0)
                {
-                       Debug( LDAP_DEBUG_TRACE,"nssov: unlink() of "NSLCD_SOCKET" failed (ignored): %s",
+                       Debug( LDAP_DEBUG_TRACE,"nssov: unlink() of "NSLCD_SOCKET" failed (ignored): %s\n",
                                                        strerror(errno),0,0);
                }
                /* create socket address structure */
index 54b2f55e5f636e797174b410c269c104deb4c7fe..6e65ce074559b0be433d2b91536eacf9de716179 100644 (file)
@@ -9,8 +9,12 @@
 #ifndef NSSOV_H
 #define NSSOV_H
 
+#ifndef NSLCD_PATH
+#define        NSLCD_PATH      "/var/run/nslcd"
+#endif
+
 #ifndef NSLCD_SOCKET
-#define NSLCD_SOCKET   "/var/run/nslcd/socket"
+#define NSLCD_SOCKET   NSLCD_PATH "/socket"
 #endif
 
 #include <stdio.h>