* Sysconfig commands for specifying where the LDAP server lives
authorArt Cancro <ajc@citadel.org>
Sat, 17 Jan 2004 04:23:28 +0000 (04:23 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 17 Jan 2004 04:23:28 +0000 (04:23 +0000)
citadel/ChangeLog
citadel/citadel.h
citadel/citadel_ipc.c
citadel/citserver.c
citadel/control.c
citadel/ipcdef.h
citadel/routines2.c
citadel/serv_upgrade.c
citadel/serv_vandelay.c
citadel/techdoc/session.txt

index d14b0a067206b0762ab439075d035fdbf178d264..029ac20ae99c0e987c72dbdabaa26f58a2e8e244 100644 (file)
@@ -1,4 +1,7 @@
  $Log$
+ Revision 614.4  2004/01/17 04:23:28  ajc
+ * Sysconfig commands for specifying where the LDAP server lives
+
  Revision 614.3  2004/01/17 03:26:17  ajc
  * Changed a diagnostic in msgbase.c to a higher logging level so it doesn't
    make as much noise.
@@ -5222,3 +5225,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
+
index 3d74cec02535678fc2d40fd147fb1469699f0f02..b88dc9d4e37b13d945448f7ac55460dc56ea3b16 100644 (file)
@@ -44,9 +44,9 @@ extern "C" {
  * usually more strict because you're not really supposed to dump/load and
  * upgrade at the same time.
  */
-#define REV_LEVEL      614             /* This version */
+#define REV_LEVEL      615             /* This version */
 #define REV_MIN                591             /* Oldest compatible database */
-#define EXPORT_REV_MIN 614             /* Oldest compatible export files */
+#define EXPORT_REV_MIN 615             /* Oldest compatible export files */
 
 #define SERVER_TYPE 0  /* zero for stock Citadel/UX; other developers please
                           obtain SERVER_TYPE codes for your implementations */
@@ -130,6 +130,8 @@ struct config {
        char c_aideroom[ROOMNAMELEN];   /* Name of aideroom (Aide)          */
        int c_purge_hour;               /* Hour during which db purges run  */
        struct ExpirePolicy c_mbxep;    /* Expire policy for mailbox rooms  */
+       char c_ldap_host[128];          /* Host where LDAP service lives    */
+       int c_ldap_port;                /* Port on host where LDAP lives    */
 };
 
 /*
index 7f26170b9f9577365e17c023c988ba8384e81907..9ef8c5174e162296717d3479653bda99a6b0f583 100644 (file)
@@ -645,6 +645,7 @@ int CtdlIPCServerInfo(CtdlIPC *ipc, struct CtdlServInfo *ServInfo, char *cret)
                        case 11:        ServInfo->serv_paging_level = atoi(buf);
                                        break;
                        case 13:        ServInfo->serv_supports_qnop = atoi(buf);
+                       case 14:        ServInfo->serv_supports_ldap = atoi(buf);
                                        break;
                        }
                }
index 7c6492a2ab823d53dca5d4fe299c33f708aeb272..887b4ae39df5a7f2f8b2b06f5656d142e959864c 100644 (file)
@@ -343,6 +343,11 @@ void cmd_info(void) {
        cprintf("1\n"); /* 1 = we support the extended paging options */
        cprintf("%s\n", CC->cs_nonce);
        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
        cprintf("000\n");
 }
 
index 01d2e9d80e568601f837e51232589d2bdf6f8624..207291faf45be9bf7a4f91c01c658b04d2a3ea71 100644 (file)
@@ -196,6 +196,13 @@ void cmd_conf(char *argbuf)
                cprintf("%d\n", config.c_disable_newu);
                cprintf("%d\n", config.c_aide_mailboxes);
                cprintf("%d\n", config.c_purge_hour);
+#ifdef HAVE_LDAP
+               cprintf("%s\n", config.c_ldap_host);
+               cprintf("%d\n", config.c_ldap_port);
+#else
+               cprintf("\n");
+               cprintf("0\n");
+#endif
                cprintf("000\n");
        }
 
@@ -335,6 +342,15 @@ void cmd_conf(char *argbuf)
                                        config.c_purge_hour = atoi(buf);
                                }
                                break;
+#ifdef HAVE_LDAP
+                       case 32:
+                               safestrncpy(config.c_ldap_host, buf,
+                                           sizeof config.c_ldap_host);
+                               break;
+                       case 33:
+                               config.c_ldap_port = atoi(buf);
+                               break;
+#endif
                        }
                        ++a;
                }
index 6f2e26b84b3196226ccae02dd7e0a914800a852e..36b82633a0c58ed65356fbaf52423dc369105015 100644 (file)
@@ -45,6 +45,7 @@ struct CtdlServInfo {
        int serv_ok_floors;
        int serv_paging_level;
        int serv_supports_qnop;
+       int serv_supports_ldap;
 };
 
 #define QR_PERMANENT   1               /* Room does not purge              */
index c3d4269f9cfb316d7c6de287c7c6297275a95f6f..640a16e68f53ffe49dbe5cd20bd974b676e232e8 100644 (file)
@@ -642,8 +642,11 @@ void read_bio(CtdlIPC *ipc)
  */
 void do_system_configuration(CtdlIPC *ipc)
 {
+
+#define NUM_CONFIGS 34
+
        char buf[SIZ];
-       char sc[32][SIZ];
+       char sc[NUM_CONFIGS][SIZ];
        char *resp = NULL;
        struct ExpirePolicy *site_expirepolicy = NULL;
        struct ExpirePolicy *mbx_expirepolicy = NULL;
@@ -661,7 +664,7 @@ void do_system_configuration(CtdlIPC *ipc)
                while (strlen(resp)) {
                        extract_token(buf, resp, 0, '\n');
                        remove_token(resp, 0, '\n');
-                       if (a < 32) {
+                       if (a < NUM_CONFIGS) {
                                strcpy(&sc[a][0], buf);
                        }
                        ++a;
@@ -747,6 +750,22 @@ void do_system_configuration(CtdlIPC *ipc)
        a = (a ? 0 : 1);
        snprintf(sc[25], sizeof sc[25], "%d", a);
 
+       /* LDAP settings */
+       if (serv_info.serv_supports_qnop) {
+               a = strlen(&sc[32][0]);
+               a = (a ? 1 : 0);        /* Set only to 1 or 0 */
+               a = boolprompt("Connect this Citadel to an LDAP directory", a);
+               if (a) {
+                       strprompt("Host name of LDAP server",
+                               &sc[32][0], 127);
+                       strprompt("Port number of LDAP service",
+                               &sc[33][0], 5);
+               }
+               else {
+                       strcpy(&sc[32][0], "");
+               }
+       }
+
        /* Expiry settings */
        strprompt("Default user purge time (days)", &sc[16][0], 5);
        strprompt("Default room purge time (days)", &sc[17][0], 5);
@@ -811,14 +830,14 @@ void do_system_configuration(CtdlIPC *ipc)
        scr_printf("Save this configuration? ");
        if (yesno()) {
                r = 1;
-               for (a = 0; a < 32; a++)
+               for (a = 0; a < NUM_CONFIGS; a++)
                        r += 1 + strlen(sc[a]);
                resp = (char *)calloc(1, r);
                if (!resp) {
                        err_printf("Can't save config - out of memory!\n");
                        logoff(ipc, 1);
                }
-               for (a = 0; a < 32; a++) {
+               for (a = 0; a < NUM_CONFIGS; a++) {
                        strcat(resp, sc[a]);
                        strcat(resp, "\n");
                }
index 5edbb91382a06b0549caca48e0573010a670cb4d..8a8c49213d7523d64bae2fa4de7c65c8d57dfe52 100644 (file)
@@ -164,6 +164,10 @@ void update_config(void) {
                config.c_purge_hour = 3;
        }
 
+       if (CitControl.version < 615) {
+               config.c_ldap_port = 389;
+       }
+
        put_config();
 }
 
index 83153502934169a6625a16aa728d60bad00a75ad..4dc0a2c390783a5a66a6b7b95a5bcd667c9eee31 100644 (file)
@@ -285,6 +285,8 @@ void artv_do_export(void) {
        cprintf("%d\n", config.c_purge_hour);
        cprintf("%d\n", config.c_mbxep.expire_mode);
        cprintf("%d\n", config.c_mbxep.expire_value);
+       cprintf("%s\n", config.c_ldap_host);
+       cprintf("%d\n", config.c_ldap_port);
 
        /* Export the control file */
        get_control();
@@ -344,6 +346,8 @@ void artv_import_config(void) {
        client_gets(buf);       config.c_purge_hour = atoi(buf);
        client_gets(buf);       config.c_mbxep.expire_mode = atoi(buf);
        client_gets(buf);       config.c_mbxep.expire_value = atoi(buf);
+       client_gets(config.c_ldap_host);
+       client_gets(buf);       config.c_ldap_port = atoi(buf);
        put_config();
        lprintf(7, "Imported config file\n");
 }
index 69942b0a827dba987ecca76059bc560aad42c488..10a4b95195295ca9cdbca3d560f685d130e90e2a 100644 (file)
@@ -590,6 +590,8 @@ parts of the listing:
            authentication.  If this field is present, clients may authenticate
            in this manner.
  Line 14 - Set to nonzero if this server supports the QNOP command.
+ Line 15 - Set to nonzero if this server is capable of connecting to a
+           directory service using LDAP.
 
  *** NOTE! ***   The "server type" code is intended to promote global
 compatibility in a scenario in which developers have added proprietary
@@ -1755,12 +1757,17 @@ fails for any reason, ERROR is returned.
  30. Flag (0 or 1) - disable self-service new user registration
  31. Flag (0 or 1) - Aides are allowed access to all mailboxes
  32. Hour (0 through 23) during which database auto-purge jobs are run
+ 33. Name of host where an LDAP service may be found
+ 34. Port number of LDAP service on above host
 
  CONF also accepts two additional commands: GETSYS and PUTSYS followed by an
 arbitrary MIME type (such as application/x-citadel-internet-config) which
 provides a means of storing generic configuration data in the Global System
 Configuration room without the need to add extra get/set commands to the
 server.
+ Please note that the LDAP-specific configs have no effect on Citadel servers
+in which LDAP support is not enabled.