*text = "modifications require authentication";
return LDAP_STRONG_AUTH_REQUIRED;
}
+
+#ifdef SLAP_X_LISTENER_MOD
+ if ( ! ( conn->c_listener->sl_perms & S_IWUSR ) ) {
+ /* no "w" mode means readonly */
+ *text = "modifications not allowed on this listener";
+ return LDAP_UNWILLING_TO_PERFORM;
+ }
+#endif /* SLAP_X_LISTENER_MOD */
}
}
return LDAP_OPERATIONS_ERROR;
}
}
+
+#ifdef SLAP_X_LISTENER_MOD
+ if ( !starttls && op->o_dn.bv_len == 0 ) {
+ if ( ! ( conn->c_listener->sl_perms & S_IXUSR ) ) {
+ /* no "x" mode means bind required */
+ *text = "bind required on this listener";
+ return LDAP_CONFIDENTIALITY_REQUIRED;
+ }
+ }
+
+ if ( !starttls && !updateop ) {
+ if ( ! ( conn->c_listener->sl_perms & S_IRUSR ) ) {
+ /* no "r" mode means no read */
+ *text = "read not allowed on this listener";
+ return LDAP_UNWILLING_TO_PERFORM;
+ }
+ }
+#endif /* SLAP_X_LISTENER_MOD */
+
}
if( restrictops & opflag ) {
ch_free(sal);
}
-#ifdef LDAP_PF_LOCAL
+#if defined(LDAP_PF_LOCAL) || defined(SLAP_X_LISTENER_MOD)
static int get_url_perms(
char **exts,
mode_t *perms,
return LDAP_OTHER;
}
-#endif /* LDAP_PF_LOCAL */
+#endif /* LDAP_PF_LOCAL || SLAP_X_LISTENER_MOD */
/* port = 0 indicates AF_LOCAL */
static int slap_get_listener_addresses(
struct sockaddr **sal, **psal;
int socktype = SOCK_STREAM; /* default to COTS */
-#ifdef LDAP_PF_LOCAL
+#if defined(LDAP_PF_LOCAL) || defined(SLAP_X_LISTENER_MOD)
/*
* use safe defaults
*/
- mode_t perms = S_IRWXU;
int crit = 1;
-#endif
+#endif /* LDAP_PF_LOCAL || SLAP_X_LISTENER_MOD */
rc = ldap_url_parse( url, &lud );
} else {
err = slap_get_listener_addresses(lud->lud_host, 0, &sal);
}
-
- if ( lud->lud_exts ) {
- err = get_url_perms( lud->lud_exts, &perms, &crit );
- }
#else
#ifdef NEW_LOGGING
}
}
+#if defined(LDAP_PF_LOCAL) || defined(SLAP_X_LISTENER_MOD)
+ if ( lud->lud_exts ) {
+ err = get_url_perms( lud->lud_exts, &l.sl_perms, &crit );
+ } else {
+ l.sl_perms = S_IRWXU;
+ }
+#endif /* LDAP_PF_LOCAL || SLAP_X_LISTENER_MOD */
+
ldap_free_urldesc( lud );
if ( err ) {
return -1;
#ifdef LDAP_PF_LOCAL
case AF_LOCAL: {
char *addr = ((struct sockaddr_un *)*sal)->sun_path;
- if ( chmod( addr, perms ) < 0 && crit ) {
+ if ( chmod( addr, l.sl_perms ) < 0 && crit ) {
int err = sock_errno();
#ifdef NEW_LOGGING
LDAP_LOG( CONNECTION, INFO,