]> andersk Git - moira.git/commitdiff
check for server closed at startup
authormar <mar>
Wed, 28 Jun 1989 13:19:26 +0000 (13:19 +0000)
committermar <mar>
Wed, 28 Jun 1989 13:19:26 +0000 (13:19 +0000)
clients/mailmaint/mailmaint.c
clients/moira/main.c
clients/mrcheck/mrcheck.c
clients/passwd/chfn.c
clients/passwd/chpobox.c
clients/passwd/chsh.c

index 6e02bb9599800738d68e65e04761befd8b174079..cd8ece5e67c6aaaec9c5955ee81474d135c920be 100644 (file)
@@ -106,7 +106,7 @@ main(argc, argv)
     void (*old_hook)();
 #endif
     int use_menu = 1;
-    char buf[BUFSIZ];
+    char buf[BUFSIZ], *motd;
 
     if ((whoami = rindex(argv[0], '/')) == NULL)
        whoami = argv[0];
@@ -141,6 +141,17 @@ main(argc, argv)
        goto punt;
     }
 
+    status = sms_motd(&motd);
+    if (status) {
+        com_err(whoami, status, " unable to check server status");
+       sms_disconnect();
+       exit(2);
+    }
+    if (motd) {
+       fprintf(stderr, "The SMS server is currently unavailable:\n%s\n", motd);
+       sms_disconnect();
+       exit(2);
+    }
     status = sms_auth("mailmaint");
     if (status) {
        (void) sprintf(buf, "\nAuthorization failed.\n");
index 28f75b506545dbb06136607a763c1fe4fa51a6ed..030a0c99d5a4a24b5d924a4d980205dede80e1cd 100644 (file)
@@ -60,6 +60,7 @@ main(argc, argv)
 {
     int status;
     Menu *menu;
+    char *motd;
 
     if ((user = getlogin()) == NULL) 
        user = getpwuid((int) getuid())->pw_name;
@@ -91,6 +92,14 @@ main(argc, argv)
     if ( status = sms_connect(SMS_SERVER) ) 
        ErrorExit("\nConnection to SMS server failed", status);
 
+    if ( status = sms_motd(&motd) )
+        ErrorExit("\nUnable to check server status", status);
+    if (motd) {
+       fprintf(stderr, "The SMS server is currently unavailable:\n%s\n", motd);
+       sms_disconnect();
+       exit(1);
+    }
+
     if ( status = sms_auth(program_name) ) 
        ErrorExit("\nAuthorization failed -- please run kinit", status);
 
index 570508f18665cc0a04631983b2357e7575878062..fc0a109b09f445bf422a32a793b0fe77999ab752 100644 (file)
@@ -77,7 +77,7 @@ main(argc, argv)
     char *argv[];
 
 {
-    char *args[6], buf[BUFSIZ], **service, **host;
+    char *args[6], buf[BUFSIZ], **service, **host, *motd;
     struct save_queue *services, *hosts;
     int count = 0, scream();
 
@@ -96,6 +96,16 @@ main(argc, argv)
        goto punt;
     }
 
+    status = sms_motd(&motd);
+    if (status) {
+        com_err(whoami, status, " unable to check server status");
+       exit(2);
+    }
+    if (motd) {
+       fprintf(stderr, "The SMS server is currently unavailable:\n%s\n", motd);
+       sms_disconnect();
+       exit(2);
+    }
     status = sms_auth("smscheck");
     if (status) {
        (void) sprintf(buf, "\nAuthorization failure -- run \"kinit\" \
index 004e714f96290f1af272fc6b238c24a04cfe5851..4cf62ab54d9bd654db08ae23ec8f5f2316fc0f6c 100644 (file)
@@ -117,6 +117,7 @@ chfn(uname)
     int status;                        /* general purpose exit status */
     int q_argc;                        /* argc for sms_query */
     char *q_argv[F_END];       /* argv for sms_query */
+    char *motd;                        /* for SMS server status */
     int i;
 
     int get_user_info();
@@ -133,6 +134,16 @@ chfn(uname)
        exit(1);
     }
 
+    status = sms_motd(&motd);
+    if (status) {
+        com_err(whoami, status, " unable to check server status");
+       leave(1);
+    }
+    if (motd) {
+       fprintf(stderr, "The SMS server is currently unavailable:\n%s\n", motd);
+       leave(1);
+    }
+
     status = sms_auth("chfn"); /* Don't use argv[0] - too easy to fake */
     if (status) {
        com_err(whoami, status, 
index 056bf0e7eec4d6460e6a7b953284593bfaf7e278..9e4b8df8f8fae53a9d5077efed9586ba2f147b57 100644 (file)
@@ -57,7 +57,7 @@ main(argc, argv)
     struct passwd *pwd;
     char *smsarg[3], buf[BUFSIZ];
     char *potype(), *index();
-    char *address, *uname, *machine;
+    char *address, *uname, *machine, *motd;
     uid_t u;
     char *canonicalize_hostname();
     int get_pobox(), scream();
@@ -128,6 +128,18 @@ main(argc, argv)
        exit(1);
     }
 
+    status = sms_motd(&motd);
+    if (status) {
+       sms_disconnect();
+        com_err(whoami, status, " unable to check server status");
+       exit(1);
+    }
+    if (motd) {
+       fprintf(stderr, "The SMS server is currently unavailable:\n%s\n", motd);
+       sms_disconnect();
+       exit(1);
+    }
+
     status = sms_auth("chpobox");
     if (status) {
        com_err(whoami, status, " while authenticating -- run \"kinit\" and try again.");
index f0fee82152f667b4b16083e74df6ab6f29259f55..d58e7f40dc98a7d0b9bf4c7484b2dca0d3e6290c 100644 (file)
@@ -105,6 +105,7 @@ chsh(uname)
     int status;                        /* general purpose exit status */
     int q_argc;                        /* argc for sms_query */
     char *q_argv[U_END];       /* argv for sms_query */
+    char *motd;                        /* determine SMS server status */
 
     int got_one = 0;           /* have we got a new shell yet? */
     char shell[BUFSIZ];                /* the new shell */
@@ -119,6 +120,16 @@ chsh(uname)
        exit(1);
     }
 
+    status = sms_motd(&motd);
+    if (status) {
+        com_err(whoami, status, " unable to check server status");
+       leave(1);
+    }
+    if (motd) {
+       fprintf(stderr, "The SMS server is currently unavailable:\n%s\n", motd);
+       leave(1);
+    }
+
     status = sms_auth("chsh"); /* Don't use argv[0] - too easy to fake */
     if (status) {
        com_err(whoami, status, 
This page took 0.056615 seconds and 5 git commands to generate.