]> code.citadel.org Git - citadel.git/blobdiff - citadel/citadel.c
removed all references to sprintf from several files (not all files yet)
[citadel.git] / citadel / citadel.c
index 5d0d90b693dae7abac9bbf7d655383668100bf53..7f5b7dd43ec84b4e3e34e760a99d7f4aa8c3fc53 100644 (file)
@@ -952,7 +952,9 @@ int main(int argc, char **argv)
        signal(SIGTERM, dropcarr);      /* Cleanup gracefully if terminated */
        signal(SIGCONT, catch_sigcont);         /* Catch SIGCONT so we can reset terminal */
 
+#ifdef HAVE_OPENSSL
        arg_encrypt = RC_DEFAULT;
+#endif
 #ifdef HAVE_CURSES_H
        arg_screen = RC_DEFAULT;
 #endif
@@ -967,12 +969,19 @@ int main(int argc, char **argv)
                        argc = shift(argc, argv, a, 2);
                }
                if (!strcmp(argv[a], "-x")) {
+#ifdef HAVE_OPENSSL
                        arg_encrypt = RC_NO;
+#endif
                        argc = shift(argc, argv, a, 1);
                }
                if (!strcmp(argv[a], "-X")) {
+#ifdef HAVE_OPENSSL
                        arg_encrypt = RC_YES;
-                       argc = shift(argc, argv, a, 1);
+                        argc = shift(argc, argv, a, 1);
+#else
+                       fprintf(stderr, "Not compiled with encryption support");
+                       return 1;
+#endif
                }
                if (!strcmp(argv[a], "-s")) {
 #ifdef HAVE_CURSES_H
@@ -1082,7 +1091,7 @@ GSTA:     /* See if we have a username and password on disk */
                        serv_gets(aaa);
                        if (nonce[0])
                        {
-                               sprintf(aaa, "PAS2 %s", make_apop_string(password, nonce, hexstring));
+                               snprintf(aaa, sizeof aaa, "PAS2 %s", make_apop_string(password, nonce, hexstring, sizeof hexstring));
                        }
                        else    /* Else no APOP */
                        {
@@ -1140,11 +1149,11 @@ GSTA:   /* See if we have a username and password on disk */
 
        if (nonce[0])
        {
-               sprintf(aaa, "PAS2 %s", make_apop_string(password, nonce, hexstring));
+               snprintf(aaa, sizeof aaa, "PAS2 %s", make_apop_string(password, nonce, hexstring, sizeof hexstring));
        }
        else    /* Else no APOP */
        {
-                       snprintf(aaa, sizeof(aaa)-1, "PASS %s", password);
+               snprintf(aaa, sizeof aaa, "PASS %s", password);
        }
        
        serv_puts(aaa);