From: Pierangelo Masarati Date: Sat, 23 Mar 2002 16:07:19 +0000 (+0000) Subject: improvement of permission handling of local sockets (ITS#1660, issue 2) X-Git-Tag: OPENLDAP_REL_ENG_2_MP~330 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6174cb652908d9c4c5cce3e020a75413a907f809;p=openldap improvement of permission handling of local sockets (ITS#1660, issue 2) --- diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index aca6614a0e..a03da830b2 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -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 */