Reworked ctdlsh to use the new admin socket instead of ipgm
authorArt Cancro <ajc@uncensored.citadel.org>
Thu, 23 Feb 2012 16:05:52 +0000 (11:05 -0500)
committerArt Cancro <ajc@uncensored.citadel.org>
Thu, 23 Feb 2012 16:05:52 +0000 (11:05 -0500)
ctdlsh/src/ctdlsh.h
ctdlsh/src/main.c

index caf4b51..db60797 100644 (file)
  */
 #define CTDLDIR        "/appl/citadel"
 
-/*
- * This is a small subset of 'struct config' ... don't worry about the rest; we
- * only need to snarf the c_ipgm_secret.
- */
-struct partial_config {
-       char c_nodename[16];            /* Unqualified "short" nodename     */
-       char c_fqdn[64];                /* Fully Qualified Domain Name      */
-       char c_humannode[21];           /* Long name of system              */
-       char c_phonenum[16];            /* Dialup number of system          */
-       uid_t c_ctdluid;                /* UID under which we run Citadel   */
-       char c_creataide;               /* room creator = room aide  flag   */
-       int c_sleeping;                 /* watchdog timer setting           */
-       char c_initax;                  /* initial access level             */
-       char c_regiscall;               /* call number to register on       */
-       char c_twitdetect;              /* twit detect flag                 */
-       char c_twitroom[128];           /* twit detect msg move to room     */
-       char c_moreprompt[80];          /* paginator prompt                 */
-       char c_restrict;                /* restrict Internet mail flag      */
-       long c_niu_1;                   /* (not in use)                     */
-       char c_site_location[32];       /* physical location of server      */
-       char c_sysadm[26];              /* name of system administrator     */
-       char c_niu_2[15];               /* (not in use)                     */
-       int c_setup_level;              /* what rev level we've setup to    */
-       int c_maxsessions;              /* maximum concurrent sessions      */
-       char c_ip_addr[20];             /* IP address to listen on          */
-       int c_port_number;              /* Cit listener port (usually 504)  */
-       int c_ipgm_secret;              /* Internal program authentication  */
-};
-
 typedef int ctdlsh_cmdfunc_t(int, char *);
 
 enum ctdlsh_cmdfunc_return_values {
index 1b16be3..99c85d0 100644 (file)
@@ -6,8 +6,6 @@
 #include "ctdlsh.h"
 
 
-
-
 int cmd_quit(int sock, char *cmdbuf) {
        return(cmdret_exit);
 }
@@ -44,34 +42,6 @@ int cmd_help(int sock, char *cmdbuf) {
 }
 
 
-
-
-
-
-int discover_ipgm_secret(char *dirname) {
-       int fd;
-       struct partial_config ccc;
-       char configfile[1024];
-
-       sprintf(configfile, "%s/citadel.config", dirname);
-       fd = open(configfile, O_RDONLY);
-       if (fd < 0) {
-               fprintf(stderr, "%s: %s\n", configfile, strerror(errno));
-               return(-1);
-       }
-
-       if (read(fd, &ccc, sizeof(struct partial_config)) != sizeof(struct partial_config)) {
-               fprintf(stderr, "%s: %s\n", configfile, strerror(errno));
-               return(-1);
-       }
-       if (close(fd) != 0) {
-               fprintf(stderr, "%s: %s\n", configfile, strerror(errno));
-               return(-1);
-       }
-       return(ccc.c_ipgm_secret);
-}
-
-
 /* Auto-completer function */
 char *command_generator(const char *text, int state) {
        static int list_index;
@@ -159,7 +129,6 @@ int main(int argc, char **argv)
 {
        int server_socket = 0;
        char buf[1024];
-       int ipgm_secret = (-1);
        int c;
        char *ctdldir = CTDLDIR;
 
@@ -184,25 +153,14 @@ int main(int argc, char **argv)
                }
        }
 
-       ipgm_secret = discover_ipgm_secret(ctdldir);
-       if (ipgm_secret < 0) {
-               exit(1);
-       }
-
        printf("Trying %s...\n", ctdldir);
-       sprintf(buf, "%s/citadel.socket", ctdldir);
+       sprintf(buf, "%s/citadel-admin.socket", ctdldir);
        server_socket = uds_connectsock(buf);
        if (server_socket < 0) {
                exit(1);
        }
 
        sock_getln(server_socket, buf, sizeof buf);
-       printf("%s\n", buf);
-
-       sock_printf(server_socket, "IPGM %d\n", ipgm_secret);
-       sock_getln(server_socket, buf, sizeof buf);
-       printf("%s\n", buf);
-
        if (buf[0] == '2') {
                do_main_loop(server_socket);
        }