summaryrefslogtreecommitdiffstats
path: root/source/lib/smbldap.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/lib/smbldap.c')
-rw-r--r--source/lib/smbldap.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/lib/smbldap.c b/source/lib/smbldap.c
index 315b1e3b456..bcde53c3e5c 100644
--- a/source/lib/smbldap.c
+++ b/source/lib/smbldap.c
@@ -1023,6 +1023,13 @@ static int smbldap_open(struct smbldap_state *ldap_state)
int rc, opt_rc;
bool reopen = False;
SMB_ASSERT(ldap_state);
+
+#ifndef NO_LDAP_SECURITY
+ if (geteuid() != 0) {
+ DEBUG(0, ("smbldap_open: cannot access LDAP when not root\n"));
+ return LDAP_INSUFFICIENT_ACCESS;
+ }
+#endif
if ((ldap_state->ldap_struct != NULL) && ((ldap_state->last_ping + SMBLDAP_DONT_PING_TIME) < time(NULL))) {