]> git.sur5r.net Git - openldap/commitdiff
improvement of permission handling of local sockets (ITS#1660, issue 2)
authorPierangelo Masarati <ando@openldap.org>
Sat, 23 Mar 2002 16:07:19 +0000 (16:07 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sat, 23 Mar 2002 16:07:19 +0000 (16:07 +0000)
servers/slapd/daemon.c

index aca6614a0e5d108d0ead99bb89e73bf45ccfd909..a03da830b2f31c55c53f40b4218ef0181b7b1d53 100644 (file)
@@ -426,38 +426,25 @@ static int get_url_perms(
                                return LDAP_OTHER;
                        } 
 #else
+                       int     j;
+
                        if ( strlen(value) != 3 ) {
                                return LDAP_OTHER;
                        } 
 
-                       switch ( value[ 0 ] ) {
-                       case 'w':
-                               p |= S_IRWXU;
-                               break;
-                       case '-':
-                               break;
-                       default:
-                               return LDAP_OTHER;
-                       } 
+                       for ( j = 0; j < 3; j++ ) {
+                               static mode_t   m[ 3 ] 
+                                       = { S_IRWXU, S_IRWXG, S_IRWXO };
 
-                       switch ( value[ 1 ] ) {
-                       case 'w':
-                               p |= S_IRWXG;
-                               break;
-                       case '-':
-                               break;
-                       default:
-                               return LDAP_OTHER;
-                       } 
-
-                       switch ( value[ 2 ] ) {
-                       case 'w':
-                               p |= S_IRWXO;
-                               break;
-                       case '-':
-                               break;
-                       default:
-                               return LDAP_OTHER;
+                               switch ( value[ j ] ) {
+                               case 'w':
+                                       p |= m[ j ];
+                                       break;
+                               case '-':
+                                       break;
+                               default:
+                                       return LDAP_OTHER;
+                               }
                        } 
 #endif
 
@@ -467,6 +454,8 @@ static int get_url_perms(
                        return LDAP_SUCCESS;
                }
        }
+
+       return LDAP_OTHER;
 }
 #endif /* LDAP_PF_LOCAL */