X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=ctdlsh%2Fsrc%2Fmain.c;h=99c85d00c6b5e2b3dcd38c5d42299ecbb4328e78;hb=14ab5b2d5253a7c05f806b0baef90d4916f82e66;hp=3dd4b9dd7136d16eec6cbacd3f08cdc16f35244b;hpb=e6a5acbf98d6e370d9408047e84d0f9adc90a0b8;p=citadel.git diff --git a/ctdlsh/src/main.c b/ctdlsh/src/main.c index 3dd4b9dd7..99c85d00c 100644 --- a/ctdlsh/src/main.c +++ b/ctdlsh/src/main.c @@ -6,8 +6,6 @@ #include "ctdlsh.h" - - int cmd_quit(int sock, char *cmdbuf) { return(cmdret_exit); } @@ -30,6 +28,7 @@ COMMAND commands[] = { { "date", cmd_datetime, "Print the server's date and time" }, { "time", cmd_datetime, "Print the server's date and time" }, { "passwd", cmd_passwd, "Set or change an account password" }, + { "shutdown", cmd_shutdown, "Shut down the Citadel server" }, { NULL, NULL, NULL } }; @@ -43,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; @@ -158,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; @@ -183,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); }