Check the error return from krb5_init_context(), and print an error
authorTheodore Tso <tytso@mit.edu>
Fri, 8 Nov 1996 22:27:23 +0000 (22:27 +0000)
committerTheodore Tso <tytso@mit.edu>
Fri, 8 Nov 1996 22:27:23 +0000 (22:27 +0000)
message if necessary.

Clean up gcc -Wall warnings.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9344 dc483132-0cff-0310-8789-dd5450dbe970

src/krb524/ChangeLog
src/krb524/getcred.c
src/krb524/k524init.c
src/krb524/krb524d.c
src/krb524/test.c

index 1b11212834712bd3b7841a47de3ef1ca78ed90aa..5e850418af7216efd85a04143fb4565d62f7bcfd 100644 (file)
@@ -1,3 +1,12 @@
+Thu Nov  7 15:45:16 1996  Theodore Ts'o  <tytso@rsts-11.mit.edu>
+
+       * test.c (main): 
+       * krb524d.c (main): 
+       * k524init.c (main): 
+       * getcred.c (main): Check the error return from
+               krb5_init_context(), and print an error message if
+               necessary.
+
 Wed Jul 24 02:18:02 1996  Sam Hartman  <hartmans@mit.edu>
 
        * test.c (krb4_print_ticket): s/KRB4_INT4/krb5_ui_4 so we work
index 21dd808821e35b0a16b1f0fc70607d65df0ceb2d..09ba7f391c7708968602d9322bd41ea1d76e4520 100644 (file)
@@ -34,9 +34,13 @@ main(argc, argv)
      CREDENTIALS v4creds;
      int i, ret;
      krb5_context context;
+     krb5_error_code retval;
      
-     krb5_init_context(&context);
-     krb524_init_ets(context);
+     retval = krb5_init_context(&context);
+     if (retval) {
+            com_err(argv[0], retval, "while initializing krb5");
+            exit(1);
+     }
 
      if (ret = krb5_parse_name(argv[1], &client)) {
          com_err("getcred", ret, "parsing client name");
index 79651f521004128ac6fe4d82aea1b0072427d58a..cfce77e727d89e9106eb479a5151f1a25c525b8d 100644 (file)
@@ -53,8 +53,13 @@ int main(argc, argv)
      int nodelete = 0;
      int lose = 0;
      krb5_context context;
+     krb5_error_code retval;
 
-     krb5_init_context(&context);
+     retval = krb5_init_context(&context);
+     if (retval) {
+            com_err(argv[0], retval, "while initializing krb5");
+            exit(1);
+     }
 
      while(((option =  getopt(argc, argv, "p:n")) != EOF)) {
         switch(option) {
index c765ab7ad2b0bbd68a9d061b4d6b7ada1e9135c5..5961b32d3cd1a3aff21f06858ca84e2eb0705b91 100644 (file)
@@ -91,9 +91,13 @@ int main(argc, argv)
      int ret, s;
      fd_set rfds;
      krb5_context context;
+     krb5_error_code retval;
 
-     krb5_init_context(&context);
-     krb524_init_ets(context);
+     retval = krb5_init_context(&context);
+     if (retval) {
+            com_err(argv[0], retval, "while initializing krb5");
+            exit(1);
+     }
 
      whoami = ((whoami = strrchr(argv[0], '/')) ? whoami + 1 : argv[0]);
 
@@ -216,9 +220,9 @@ void init_master(context, params)
      int ret;
 
      use_master = 0;
-     if (ret = kadm5_init(whoami, NULL, KADM5_ADMIN_SERVICE, params,
-                         KADM5_STRUCT_VERSION, KADM5_API_VERSION_2,
-                         &handle)) {
+     if ((ret = kadm5_init(whoami, NULL, KADM5_ADMIN_SERVICE, params,
+                          KADM5_STRUCT_VERSION, KADM5_API_VERSION_2,
+                          &handle))) {
          com_err(whoami, ret, "initializing kadm5 library");
          cleanup_and_exit(1, context);
      }
@@ -377,8 +381,8 @@ krb5_error_code kdc_get_server_key(context, service, key, kvno, ktype)
     krb5_error_code ret;
     kadm5_principal_ent_rec server;
     
-    if (ret = kadm5_get_principal(handle, service, &server,
-                                 KADM5_KEY_DATA))
+    if ((ret = kadm5_get_principal(handle, service, &server,
+                                  KADM5_KEY_DATA)))
         return ret;
 
     /*
index 98e330ac7c1ba5bef0783956a8890001ca47cbc3..4a7911580d394df542a27a85faa2bc66221de7c6 100644 (file)
@@ -210,10 +210,15 @@ int main(argc, argv)
      int i, ret, local;
      char *remote;
      krb5_context context;
+     krb5_error_code retval;
 
      krb524_debug = 1;
 
-     krb5_init_context(&context);
+     retval = krb5_init_context(&context);
+     if (retval) {
+            com_err(argv[0], retval, "while initializing krb5");
+            exit(1);
+     }
 
      krb524_init_ets(context);