From 24d1e719dd6b40e0eb4153b928b758abb17863a1 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Mon, 15 Nov 2021 18:56:29 -0500 Subject: [PATCH] Removed the remaining code where LDAP was optional. --- citadel/config.c | 9 ------- citadel/control.c | 8 ------ citadel/housekeeping.c | 3 +-- citadel/ldap.c | 31 ++++++++++-------------- citadel/modules/ctdlproto/serv_session.c | 5 ---- citadel/modules/vcard/serv_vcard.c | 8 ++---- citadel/user_ops.c | 30 +++++++++-------------- 7 files changed, 27 insertions(+), 67 deletions(-) diff --git a/citadel/config.c b/citadel/config.c index bd915f4c4..d04f87434 100644 --- a/citadel/config.c +++ b/citadel/config.c @@ -265,15 +265,6 @@ void initialize_config_system(void) { brand_new_installation_set_defaults(); } - /* Only allow LDAP auth mode if we actually have LDAP support */ -#ifndef HAVE_LDAP - if ((CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP) || (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP_AD)) { - fprintf(stderr, "Your system is configured for LDAP authentication,\n" - "but you are running a server built without OpenLDAP support.\n"); - exit(CTDL_EXIT_UNSUP_AUTH); - } -#endif - /* Default maximum message length is 10 megabytes. This is site * configurable. Also check to make sure the limit has not been * set below 8192 bytes. diff --git a/citadel/control.c b/citadel/control.c index 9e790e5b0..645904267 100644 --- a/citadel/control.c +++ b/citadel/control.c @@ -295,19 +295,11 @@ void cmd_conf(char *argbuf) cprintf("%d\n", CtdlGetConfigInt("c_disable_newu")); cprintf("1\n"); /* niu */ cprintf("%d\n", CtdlGetConfigInt("c_purge_hour")); -#ifdef HAVE_LDAP cprintf("%s\n", CtdlGetConfigStr("c_ldap_host")); cprintf("%d\n", CtdlGetConfigInt("c_ldap_port")); cprintf("%s\n", CtdlGetConfigStr("c_ldap_base_dn")); cprintf("%s\n", CtdlGetConfigStr("c_ldap_bind_dn")); cprintf("%s\n", CtdlGetConfigStr("c_ldap_bind_pw")); -#else - cprintf("\n"); - cprintf("0\n"); - cprintf("\n"); - cprintf("\n"); - cprintf("\n"); -#endif cprintf("%s\n", CtdlGetConfigStr("c_ip_addr")); cprintf("%d\n", CtdlGetConfigInt("c_msa_port")); cprintf("%d\n", CtdlGetConfigInt("c_imaps_port")); diff --git a/citadel/housekeeping.c b/citadel/housekeeping.c index 4de8e4baf..54cfe11b8 100644 --- a/citadel/housekeeping.c +++ b/citadel/housekeeping.c @@ -146,13 +146,12 @@ void do_housekeeping(void) { cdb_check_handles(); PerformSessionHooks(EVT_TIMER); // Run all registered TIMER hooks -#ifdef HAVE_LDAP // LDAP sync isn't in a module so we can put it here + // LDAP sync isn't in a module so we can put it here static time_t last_ldap_sync = 0L; if ( (now - last_ldap_sync) > (time_t)CtdlGetConfigLong("c_ldap_sync_freq") ) { CtdlSynchronizeUsersFromLDAP(); last_ldap_sync = time(NULL); } -#endif keep_an_eye_on_memory_usage(); } diff --git a/citadel/ldap.c b/citadel/ldap.c index 73e45ba23..f78130f95 100644 --- a/citadel/ldap.c +++ b/citadel/ldap.c @@ -1,17 +1,15 @@ -/* - * These functions implement the portions of AUTHMODE_LDAP and AUTHMODE_LDAP_AD which - * actually speak to the LDAP server. - * - * Copyright (c) 2011-2017 by the citadel.org development team. - * - * This program is open source software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ +// These functions implement the portions of AUTHMODE_LDAP and AUTHMODE_LDAP_AD which +// actually speak to the LDAP server. +// +// Copyright (c) 2011-2021 by the citadel.org development team. +// +// This program is open source software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License, version 3. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. int ctdl_require_ldap_version = 3; @@ -24,10 +22,9 @@ int ctdl_require_ldap_version = 3; #include "user_ops.h" #include "internet_addressing.h" #include "config.h" +#include -#ifdef HAVE_LDAP #define LDAP_DEPRECATED 1 // Suppress libldap's warning that we are using deprecated API calls -#include /* @@ -632,5 +629,3 @@ void CtdlSynchronizeUsersFromLDAP(void) /* unbind so we can go back in as the authenticating user */ ldap_unbind(ldserver); } - -#endif /* HAVE_LDAP */ diff --git a/citadel/modules/ctdlproto/serv_session.c b/citadel/modules/ctdlproto/serv_session.c index 739de3fa9..697cc9371 100644 --- a/citadel/modules/ctdlproto/serv_session.c +++ b/citadel/modules/ctdlproto/serv_session.c @@ -66,12 +66,7 @@ void cmd_info(char *cmdbuf) { cprintf("1\n"); /* 1 = we support the extended paging options */ cprintf("\n"); /* no longer used */ cprintf("1\n"); /* 1 = yes, this system supports the QNOP command */ - -#ifdef HAVE_LDAP cprintf("1\n"); /* 1 = yes, this server is LDAP-enabled */ -#else - cprintf("0\n"); /* 1 = no, this server is not LDAP-enabled */ -#endif if ((CtdlGetConfigInt("c_auth_mode") == AUTHMODE_NATIVE) && (CtdlGetConfigInt("c_disable_newu") == 0)) { diff --git a/citadel/modules/vcard/serv_vcard.c b/citadel/modules/vcard/serv_vcard.c index 413be56ff..63cbb6422 100644 --- a/citadel/modules/vcard/serv_vcard.c +++ b/citadel/modules/vcard/serv_vcard.c @@ -2,7 +2,7 @@ * A server-side module for Citadel which supports address book information * using the standard vCard format. * - * Copyright (c) 1999-2020 by the citadel.org team + * Copyright (c) 1999-2021 by the citadel.org team * * This program is open source software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3. @@ -721,8 +721,6 @@ void vcard_newuser(struct ctdluser *usbuf) { } #endif - -#ifdef HAVE_LDAP /* * Is this an LDAP session? If so, copy various LDAP attributes from the directory entry * into the user's vCard. @@ -745,7 +743,7 @@ syslog(LOG_DEBUG, "\033[31m FIXME BORK BORK BORK try lookup by uid , or maybe dn } } } -#endif + if (need_default_vcard!=0) { /* Everyone gets an email address based on their display name */ snprintf(buf, sizeof buf, "%s@%s", usbuf->fullname, CtdlGetConfigStr("c_fqdn")); @@ -995,7 +993,6 @@ void vcard_CtdlCreateRoom(void) void vcard_session_login_hook(void) { struct vCard *v = NULL; -#ifdef HAVE_LDAP /* * Is this an LDAP session? If so, copy various LDAP attributes from the directory entry * into the user's vCard. @@ -1010,7 +1007,6 @@ void vcard_session_login_hook(void) { } } } -#endif /* * Extract the user's friendly/screen name diff --git a/citadel/user_ops.c b/citadel/user_ops.c index 473e83a80..a8f7b3423 100644 --- a/citadel/user_ops.c +++ b/citadel/user_ops.c @@ -1,16 +1,14 @@ -/* - * Server functions which perform operations on user objects. - * - * Copyright (c) 1987-2020 by the citadel.org team - * - * This program is open source software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ +// Server functions which perform operations on user objects. +// +// Copyright (c) 1987-2021 by the citadel.org team +// +// This program is open source software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License, version 3. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. #include #include @@ -595,7 +593,6 @@ int CtdlLoginExistingUser(const char *trythisname) } -#ifdef HAVE_LDAP else if ((CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP) || (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP_AD)) { /* LDAP auth mode */ @@ -621,7 +618,6 @@ int CtdlLoginExistingUser(const char *trythisname) } } -#endif else { /* native auth mode */ @@ -685,7 +681,6 @@ void do_login(void) CtdlPutUserLock(&CC->user); /* If we are using LDAP authentication, extract the user's email addresses from the directory. */ -#ifdef HAVE_LDAP if ((CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP) || (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP_AD)) { char new_emailaddrs[512]; if (CtdlGetConfigInt("c_ldap_sync_email_addrs") > 0) { @@ -694,7 +689,6 @@ void do_login(void) } } } -#endif /* If the user does not have any email addresses assigned, generate one. */ if (IsEmptyStr(CC->user.emailaddrs)) { @@ -917,7 +911,6 @@ int CtdlTryPassword(const char *password, long len) } } -#ifdef HAVE_LDAP else if ((CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP) || (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP_AD)) { /* LDAP auth mode */ @@ -929,7 +922,6 @@ int CtdlTryPassword(const char *password, long len) code = (-1); } } -#endif else { -- 2.30.2