* misc.c, schpw.c: Cleanup assignments in conditionals
authorEzra Peisach <epeisach@mit.edu>
Mon, 4 Jun 2001 21:26:34 +0000 (21:26 +0000)
committerEzra Peisach <epeisach@mit.edu>
Mon, 4 Jun 2001 21:26:34 +0000 (21:26 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13268 dc483132-0cff-0310-8789-dd5450dbe970

src/kadmin/server/ChangeLog
src/kadmin/server/misc.c
src/kadmin/server/schpw.c

index 07775f6cdaff0e91da594d58497a99e6886ac54c..511881b824d86efbac5cf456b69bad9f18be2642 100644 (file)
@@ -1,4 +1,8 @@
-Sun Feb 18 16:23:59 2001  Ezra Peisach  <epeisach@mit.edu>
+2001-06-04  Ezra Peisach  <epeisach@mit.edu>
+
+       * misc.c, schpw.c: Cleanup assignments in conditionals.
+
+2001-02-18  Ezra Peisach  <epeisach@mit.edu>
 
        * kadm_rpc_svc.c, server_stubs.c: Rename all server side dispatch
         routines to end in _svc so as to not conflict with prototypes of
index 9dc3d9d28fa7ab88d5fa18c6aa3a2f9f4ffb195f..ea0e4ce80127d99b5fce55e1f5e73d6a5593c3ec 100644 (file)
@@ -44,13 +44,13 @@ chpass_principal_wrapper(void *server_handle,
     kadm5_principal_ent_rec    princ;
     kadm5_server_handle_t      handle = server_handle;
 
-    if (ret = krb5_timeofday(handle->context, &now))
+    ret = krb5_timeofday(handle->context, &now);
+    if (ret)
        return ret;
 
-    if((ret = kadm5_get_principal(handle->lhandle, principal,
-                                 &princ,
-                                 KADM5_PRINCIPAL_NORMAL_MASK)) !=
-       KADM5_OK) 
+    ret = kadm5_get_principal(handle->lhandle, principal,
+                             &princ, KADM5_PRINCIPAL_NORMAL_MASK);
+    if(ret != KADM5_OK) 
         return ret;
     if(princ.aux_attributes & KADM5_POLICY) {
        if((ret=kadm5_get_policy(handle->lhandle,
@@ -64,12 +64,16 @@ chpass_principal_wrapper(void *server_handle,
            (void) kadm5_free_principal_ent(handle->lhandle, &princ);
            return KADM5_PASS_TOOSOON;
        }
-       if (ret = kadm5_free_policy_ent(handle->lhandle, &pol)) {
+
+       ret = kadm5_free_policy_ent(handle->lhandle, &pol);
+       if (ret) {
            (void) kadm5_free_principal_ent(handle->lhandle, &princ);
            return ret;
         }
     }
-    if (ret = kadm5_free_principal_ent(handle->lhandle, &princ))
+
+    ret = kadm5_free_principal_ent(handle->lhandle, &princ);
+    if (ret)
         return ret;
     
     return kadm5_chpass_principal(server_handle, principal, password);
@@ -107,13 +111,13 @@ randkey_principal_wrapper(void *server_handle,
     kadm5_principal_ent_rec    princ;
     kadm5_server_handle_t      handle = server_handle;
 
-    if (ret = krb5_timeofday(handle->context, &now))
+    ret = krb5_timeofday(handle->context, &now);
+    if (ret)
        return ret;
 
-    if((ret = kadm5_get_principal(handle->lhandle,
-                                 principal, &princ,
-                                 KADM5_PRINCIPAL_NORMAL_MASK)) !=
-       OSA_ADB_OK) 
+    ret = kadm5_get_principal(handle->lhandle, principal, 
+                             &princ, KADM5_PRINCIPAL_NORMAL_MASK);
+    if(ret != OSA_ADB_OK) 
         return ret;
     if(princ.aux_attributes & KADM5_POLICY) {
        if((ret=kadm5_get_policy(handle->lhandle,
@@ -127,12 +131,16 @@ randkey_principal_wrapper(void *server_handle,
            (void) kadm5_free_principal_ent(handle->lhandle, &princ);
            return KADM5_PASS_TOOSOON;
        }
-       if (ret = kadm5_free_policy_ent(handle->lhandle, &pol)) {
+
+       ret = kadm5_free_policy_ent(handle->lhandle, &pol);
+       if (ret) {
            (void) kadm5_free_principal_ent(handle->lhandle, &princ);
            return ret;
         }
     }
-    if (ret = kadm5_free_principal_ent(handle->lhandle, &princ))
+
+    ret = kadm5_free_principal_ent(handle->lhandle, &princ);
+    if (ret)
         return ret;
     return kadm5_randkey_principal(server_handle, principal, keys, n_keys);
 }
index 9de81160bc2adb954bb34305fdb867beab95f838..c65555bf50eabc9db1546152e1fae52505e2e1a3 100644 (file)
@@ -92,21 +92,24 @@ process_chpw_request(context, server_handle, realm, s, keytab, sin, req, rep)
     ap_req.data = ptr;
     ptr += ap_req.length;
 
-    if (ret = krb5_auth_con_init(context, &auth_context)) {
+    ret = krb5_auth_con_init(context, &auth_context);
+    if (ret) {
        numresult = KRB5_KPASSWD_HARDERROR;
        strcpy(strresult, "Failed initializing auth context");
        goto chpwfail;
     }
 
-    if (ret = krb5_auth_con_setflags(context, auth_context,
-                                    KRB5_AUTH_CONTEXT_DO_SEQUENCE)) {
+    ret = krb5_auth_con_setflags(context, auth_context,
+                                KRB5_AUTH_CONTEXT_DO_SEQUENCE);
+    if (ret) {
        numresult = KRB5_KPASSWD_HARDERROR;
        strcpy(strresult, "Failed initializing auth context");
        goto chpwfail;
     }
        
-    if (ret = krb5_build_principal(context, &changepw, strlen(realm), realm,
-                                  "kadmin", "changepw", NULL)) {
+    ret = krb5_build_principal(context, &changepw, strlen(realm), realm,
+                              "kadmin", "changepw", NULL);
+    if (ret) {
        numresult = KRB5_KPASSWD_HARDERROR;
        strcpy(strresult, "Failed building kadmin/changepw principal");
        goto chpwfail;
@@ -188,8 +191,9 @@ process_chpw_request(context, server_handle, realm, s, keytab, sin, req, rep)
        specified.  when rd_priv is called, *only* a remote address
        is specified.  Are we having fun yet?  */
 
-    if (ret = krb5_auth_con_setaddrs(context, auth_context, NULL,
-                                    &remote_kaddr)) {
+    ret = krb5_auth_con_setaddrs(context, auth_context, NULL,
+                            &remote_kaddr);
+    if (ret) {
        numresult = KRB5_KPASSWD_HARDERROR;
        strcpy(strresult, "Failed storing client internet address");
        goto chpwfail;
@@ -205,7 +209,8 @@ process_chpw_request(context, server_handle, realm, s, keytab, sin, req, rep)
 
     /* construct the ap-rep */
 
-    if (ret = krb5_mk_rep(context, auth_context, &ap_rep)) {
+    ret = krb5_mk_rep(context, auth_context, &ap_rep);
+    if (ret) {
        numresult = KRB5_KPASSWD_AUTHERROR;
        strcpy(strresult, "Failed replying to application request");
        goto chpwfail;
@@ -216,7 +221,8 @@ process_chpw_request(context, server_handle, realm, s, keytab, sin, req, rep)
     cipher.length = (req->data + req->length) - ptr;
     cipher.data = ptr;
 
-    if (ret = krb5_rd_priv(context, auth_context, &cipher, &clear, &replay)) {
+    ret = krb5_rd_priv(context, auth_context, &cipher, &clear, &replay);
+    if (ret) {
        numresult = KRB5_KPASSWD_HARDERROR;
        strcpy(strresult, "Failed decrypting request");
        goto chpwfail;
@@ -269,14 +275,16 @@ chpwfail:
     cipher.length = 0;
 
     if (ap_rep.length) {
-       if (ret = krb5_auth_con_setaddrs(context, auth_context, &local_kaddr,
-                                        NULL)) {
+       ret = krb5_auth_con_setaddrs(context, auth_context, &local_kaddr,
+                                    NULL);
+       if (ret) {
            numresult = KRB5_KPASSWD_HARDERROR;
            strcpy(strresult,
                   "Failed storing client and server internet addresses");
        } else {
-           if (ret = krb5_mk_priv(context, auth_context, &clear, &cipher,
-                                  &replay)) {
+           ret = krb5_mk_priv(context, auth_context, &clear, &cipher,
+                              &replay);
+           if (ret) {
                numresult = KRB5_KPASSWD_HARDERROR;
                strcpy(strresult, "Failed encrypting reply");
            }
@@ -298,7 +306,8 @@ chpwfail:
        krberror.ctime = 0;
        krberror.cusec = 0;
        krberror.susec = 0;
-       if (ret = krb5_timeofday(context, &krberror.stime))
+       ret = krb5_timeofday(context, &krberror.stime);
+       if (ret)
            goto bailout;
 
        /* this is really icky.  but it's what all the other callers
@@ -309,9 +318,11 @@ chpwfail:
            krberror.error = KRB_ERR_GENERIC;
 
        krberror.client = NULL;
-       if (ret = krb5_build_principal(context, &krberror.server,
-                                      strlen(realm), realm,
-                                      "kadmin", "changepw", NULL))
+
+       ret = krb5_build_principal(context, &krberror.server,
+                                  strlen(realm), realm,
+                                  "kadmin", "changepw", NULL);
+       if (ret)
            goto bailout;
        krberror.text.length = 0;
        krberror.e_data = clear;