mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
change socket permission syntax (to reuse function for other purposes)
This commit is contained in:
parent
456a561b65
commit
fdd586a6b7
@ -334,27 +334,53 @@ static int get_url_perms(
|
||||
}
|
||||
|
||||
if ( strncasecmp( type, LDAPI_MOD_URLEXT "=", sizeof(LDAPI_MOD_URLEXT "=") - 1 ) == 0 ) {
|
||||
char *value = type + sizeof(LDAPI_MOD_URLEXT "=") - 1;
|
||||
char *value = type
|
||||
+ ( sizeof(LDAPI_MOD_URLEXT "=") - 1 );
|
||||
mode_t p = 0;
|
||||
int j;
|
||||
|
||||
if ( strlen(value) != 3 ) {
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
|
||||
for ( j = 0; j < 3; j++ ) {
|
||||
static mode_t m[ 3 ]
|
||||
= { S_IRWXU, S_IRWXG, S_IRWXO };
|
||||
|
||||
switch ( value[ j ] ) {
|
||||
case 'w':
|
||||
p |= m[ j ];
|
||||
break;
|
||||
case '-':
|
||||
break;
|
||||
default:
|
||||
switch (strlen(value)) {
|
||||
case 4:
|
||||
/* skip leading '0' */
|
||||
if ( value[ 0 ] != '0' ) {
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
value++;
|
||||
|
||||
case 3:
|
||||
for ( j = 0; j < 3; j++) {
|
||||
int v;
|
||||
|
||||
v = value[ j ] - '0';
|
||||
|
||||
if ( v < 0 || v > 7 ) {
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
|
||||
p |= v << 3*(2-j);
|
||||
}
|
||||
break;
|
||||
|
||||
case 10:
|
||||
for ( j = 1; j < 10; j++ ) {
|
||||
static mode_t m[] = { 0,
|
||||
S_IRUSR, S_IWUSR, S_IXUSR,
|
||||
S_IRGRP, S_IWGRP, S_IXGRP,
|
||||
S_IROTH, S_IWOTH, S_IXOTH
|
||||
};
|
||||
static char c[] = "-rwxrwxrwx";
|
||||
|
||||
if ( value[ j ] == c[ j ] ) {
|
||||
p |= m[ j ];
|
||||
|
||||
} else if ( value[ j ] != '-' ) {
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
|
||||
*crit = c;
|
||||
@ -1342,7 +1368,7 @@ slapd_daemon_task(
|
||||
char *authid = NULL;
|
||||
|
||||
char *dnsname = NULL;
|
||||
char *peeraddr;
|
||||
char *peeraddr = NULL;
|
||||
#ifdef LDAP_PF_LOCAL
|
||||
char peername[MAXPATHLEN + sizeof("PATH=")];
|
||||
#elif defined(LDAP_PF_INET6)
|
||||
|
Loading…
Reference in New Issue
Block a user