]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
removed default parameters arguments
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Mon, 18 Mar 2002 07:43:13 +0000 (07:43 +0000)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Mon, 18 Mar 2002 07:43:13 +0000 (07:43 +0000)
src/cli.c
src/serv.c

index a37a9d7444b6c65181007eec1dd0747200bd7e47..e98ed34441285b6863b0abbc33967d59cdbeb74d 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -217,12 +217,14 @@ int main(int argc, char **argv)
 /*     gnutls_certificate_client_callback_func( xcred, cert_callback); */
 
    /* SRP stuff */
-   if (gnutls_srp_allocate_client_sc(&cred) < 0) {
-      fprintf(stderr, "memory error\n");
-      exit(1);
+   if (srp_username!=NULL) {
+      if (gnutls_srp_allocate_client_sc(&cred) < 0) {
+         fprintf(stderr, "memory error\n");
+         exit(1);
+      }
+      gnutls_srp_set_client_cred(cred, srp_username, srp_passwd);
    }
-   gnutls_srp_set_client_cred(cred, srp_username, srp_passwd);
-
+   
    /* ANON stuff */
    if (gnutls_anon_allocate_client_sc(&anon_cred) < 0) {
       fprintf(stderr, "memory error\n");
@@ -262,7 +264,8 @@ int main(int argc, char **argv)
       gnutls_dh_set_prime_bits(state, 1024);
 
       gnutls_cred_set(state, GNUTLS_CRD_ANON, anon_cred);
-      gnutls_cred_set(state, GNUTLS_CRD_SRP, cred);
+      if (srp_username!=NULL)
+         gnutls_cred_set(state, GNUTLS_CRD_SRP, cred);
       gnutls_cred_set(state, GNUTLS_CRD_CERTIFICATE, xcred);
 
       /* send the fingerprint */
@@ -451,7 +454,8 @@ int main(int argc, char **argv)
 
    gnutls_deinit(state);
 
-   gnutls_srp_free_client_sc(cred);
+   if (srp_username!=NULL) 
+      gnutls_srp_free_client_sc(cred);
    gnutls_certificate_free_sc(xcred);
    gnutls_anon_free_client_sc(anon_cred);
 
@@ -460,6 +464,8 @@ int main(int argc, char **argv)
    return 0;
 }
 
+#undef DEBUG
+
 static gaainfo info;
 void gaa_parser(int argc, char **argv)
 {
@@ -476,6 +482,7 @@ void gaa_parser(int argc, char **argv)
    record_max_size = info.record_size;
    fingerprint = info.fingerprint;
 
+#ifdef DEBUG
    if (info.x509_certfile != NULL)
       x509_certfile = info.x509_certfile;
    else
@@ -510,6 +517,16 @@ void gaa_parser(int argc, char **argv)
       srp_username = info.srp_username;
    else
       srp_username = DEFAULT_SRP_USERNAME;
+#else
+      srp_username = info.srp_username;
+      srp_passwd = info.srp_passwd;
+      x509_cafile = info.x509_certfile;
+      x509_keyfile = info.x509_keyfile;
+      x509_certfile = info.x509_certfile;
+      pgp_keyfile = info.pgp_keyfile;
+      pgp_certfile = info.pgp_certfile;
+
+#endif
 
    pgp_keyring = info.pgp_keyring;
    pgp_trustdb = info.pgp_trustdb;
index 022875332972bd0476d21148cf4b86e36f016415..07c98819e92082755a3a34457419be5720185198 100644 (file)
@@ -548,6 +548,8 @@ int main(int argc, char **argv)
 #define DEFAULT_SRP_PASSWD "srp/tpasswd"
 #define DEFAULT_SRP_PASSWD_CONF "srp/tpasswd.conf"
 
+#undef DEBUG
+
 static gaainfo info;
 void gaa_parser(int argc, char **argv)
 {
@@ -571,6 +573,7 @@ void gaa_parser(int argc, char **argv)
 
    port = info.port;
 
+#ifdef DEBUG
    if (info.x509_certfile != NULL)
       x509_certfile = info.x509_certfile;
    else
@@ -596,8 +599,6 @@ void gaa_parser(int argc, char **argv)
    else
       pgp_keyfile = DEFAULT_PGP_KEYFILE;
 
-   pgp_keyserver = info.pgp_keyserver;
-
    if (info.srp_passwd != NULL)
       srp_passwd = info.srp_passwd;
    else
@@ -607,7 +608,17 @@ void gaa_parser(int argc, char **argv)
       srp_passwd_conf = info.srp_passwd_conf;
    else
       srp_passwd_conf = DEFAULT_SRP_PASSWD_CONF;
+#else
+      x509_certfile = info.x509_certfile;
+      x509_keyfile = info.x509_keyfile;
+      x509_cafile = info.x509_certfile;
+      pgp_certfile = info.pgp_certfile;
+      pgp_keyfile = info.pgp_keyfile;
+      srp_passwd = info.srp_passwd;
+      srp_passwd_conf = info.srp_passwd_conf;
+#endif
 
+   pgp_keyserver = info.pgp_keyserver;
    pgp_keyring = info.pgp_keyring;
    pgp_trustdb = info.pgp_trustdb;