From: Ezra Peisach Date: Wed, 25 Apr 2001 15:14:24 +0000 (+0000) Subject: * tcl_kadm5.c, tcl_ovsec_kadm.c: Cleanup of assignments in X-Git-Tag: krb5-1.3-alpha1~1556 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=87f3ef154866dfad28853bf0da08c28bf5b688bf;p=krb5.git * tcl_kadm5.c, tcl_ovsec_kadm.c: Cleanup of assignments in conditionals, missing prototypes, etc. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13190 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/kadmin/testing/util/ChangeLog b/src/kadmin/testing/util/ChangeLog index 6b0e5db12..4f9acd1f1 100644 --- a/src/kadmin/testing/util/ChangeLog +++ b/src/kadmin/testing/util/ChangeLog @@ -1,3 +1,8 @@ +2001-04-25 Ezra Peisach + + * tcl_kadm5.c, tcl_ovsec_kadm.c: Cleanup of assignments in + conditionals, missing prototypes, etc. + 2000-05-23 Tom Yu * tcl_kadm5.c (tcl_kadm5_chpass_principal_util): Add new argument diff --git a/src/kadmin/testing/util/tcl_kadm5.c b/src/kadmin/testing/util/tcl_kadm5.c index 5d0a62bc2..a103e9abe 100644 --- a/src/kadmin/testing/util/tcl_kadm5.c +++ b/src/kadmin/testing/util/tcl_kadm5.c @@ -185,10 +185,10 @@ static int remove_server_handle(Tcl_Interp *interp, char *name) return TCL_ERROR; \ } \ { \ - int tcl_ret; \ - if ((tcl_ret = get_server_handle(interp, argv[0], &server_handle)) \ + int ltcl_ret; \ + if ((ltcl_ret = get_server_handle(interp, argv[0], &server_handle)) \ != TCL_OK) { \ - return tcl_ret; \ + return ltcl_ret; \ } \ } \ argv++, argc--; @@ -270,7 +270,8 @@ static void set_ok(Tcl_Interp *interp, char *string) static Tcl_DString *unparse_err(kadm5_ret_t code) { - char *code_string, *error_string; + char *code_string; + const char *error_string; Tcl_DString *dstring; switch (code) { @@ -403,10 +404,12 @@ static Tcl_DString *unparse_err(kadm5_ret_t code) case KRB5_CONFIG_BADFORMAT: code_string = "KRB5_CONFIG_BADFORMAT"; break; case EINVAL: code_string = "EINVAL"; break; case ENOENT: code_string = "ENOENT"; break; - default: fprintf(stderr, "**** CODE %d ***\n", code); code_string = "UNKNOWN"; break; + default: + fprintf(stderr, "**** CODE %ld ***\n", (long) code); + code_string = "UNKNOWN"; break; } - error_string = (char *) error_message(code); + error_string = error_message(code); if (! (dstring = (Tcl_DString *) malloc(sizeof(Tcl_DString)))) { fprintf(stderr, "Out of memory!\n"); @@ -669,7 +672,8 @@ static Tcl_DString *unparse_principal_ent(kadm5_principal_ent_t princ, /* it should be initialized to 0 if I want it do be */ /* allocated automatically. */ if (mask & KADM5_PRINCIPAL) { - if ( krb5_ret = krb5_unparse_name(context, princ->principal, &tmp)) { + krb5_ret = krb5_unparse_name(context, princ->principal, &tmp); + if (krb5_ret) { /* XXX Do we want to return an error? Not sure. */ Tcl_DStringAppendElement(str, "[unparseable principal]"); } @@ -694,7 +698,7 @@ static Tcl_DString *unparse_principal_ent(kadm5_principal_ent_t princ, tmp = 0; if (mask & KADM5_MOD_NAME) { - if (krb5_ret = krb5_unparse_name(context, princ->mod_name, &tmp)) { + if ((krb5_ret = krb5_unparse_name(context, princ->mod_name, &tmp))) { /* XXX */ Tcl_DStringAppendElement(str, "[unparseable principal]"); } @@ -832,8 +836,8 @@ static int parse_key_data(Tcl_Interp *interp, char *list, krb5_key_data **key_data, int n_key_data) { - char **argv, **argv1 = NULL; - int i, tmp, argc, argc1, retcode; + char **argv; + int argc, retcode; *key_data == NULL; if (list == NULL) { @@ -1342,22 +1346,22 @@ static Tcl_DString *unparse_policy_ent(kadm5_policy_ent_t policy) Tcl_DStringFree(tmp_dstring); free(tmp_dstring); - sprintf(buf, "%d", policy->pw_min_life); + sprintf(buf, "%ld", policy->pw_min_life); Tcl_DStringAppendElement(str, buf); - sprintf(buf, "%d", policy->pw_max_life); + sprintf(buf, "%ld", policy->pw_max_life); Tcl_DStringAppendElement(str, buf); - sprintf(buf, "%d", policy->pw_min_length); + sprintf(buf, "%ld", policy->pw_min_length); Tcl_DStringAppendElement(str, buf); - sprintf(buf, "%d", policy->pw_min_classes); + sprintf(buf, "%ld", policy->pw_min_classes); Tcl_DStringAppendElement(str, buf); - sprintf(buf, "%d", policy->pw_history_num); + sprintf(buf, "%ld", policy->pw_history_num); Tcl_DStringAppendElement(str, buf); - sprintf(buf, "%d", policy->policy_refcnt); + sprintf(buf, "%ld", policy->policy_refcnt); Tcl_DStringAppendElement(str, buf); return str; @@ -1542,11 +1546,11 @@ static Tcl_DString *unparse_keyblocks(krb5_keyblock *keyblocks, int num_keys) enum init_type { INIT_NONE, INIT_PASS, INIT_CREDS }; -int _tcl_kadm5_init_any(enum init_type init_type, ClientData clientData, +static int _tcl_kadm5_init_any(enum init_type init_type, ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]) { kadm5_ret_t ret; - char *client_name, *pass, *service_name, *realm; + char *client_name, *pass, *service_name; int tcl_ret; krb5_ui_4 struct_version, api_version; char *handle_var; @@ -1589,12 +1593,12 @@ int _tcl_kadm5_init_any(enum init_type init_type, ClientData clientData, krb5_ccache cc; if (pass == NULL) { - if (ret = krb5_cc_default(context, &cc)) { + if ((ret = krb5_cc_default(context, &cc))) { stash_error(interp, ret); return TCL_ERROR; } } else { - if (ret = krb5_cc_resolve(context, pass, &cc)) { + if ((ret = krb5_cc_resolve(context, pass, &cc))) { stash_error(interp, ret); return TCL_ERROR; } @@ -1627,20 +1631,20 @@ int _tcl_kadm5_init_any(enum init_type init_type, ClientData clientData, return TCL_OK; } -int tcl_kadm5_init(ClientData clientData, Tcl_Interp *interp, - int argc, char *argv[]) +static int tcl_kadm5_init(ClientData clientData, Tcl_Interp *interp, + int argc, char *argv[]) { return _tcl_kadm5_init_any(INIT_PASS, clientData, interp, argc, argv); } -int tcl_kadm5_init_with_creds(ClientData clientData, Tcl_Interp *interp, - int argc, char *argv[]) +static int tcl_kadm5_init_with_creds(ClientData clientData, Tcl_Interp *interp, + int argc, char *argv[]) { return _tcl_kadm5_init_any(INIT_CREDS, clientData, interp, argc, argv); } -int tcl_kadm5_destroy(ClientData clientData, Tcl_Interp *interp, - int argc, char *argv[]) +static int tcl_kadm5_destroy(ClientData clientData, Tcl_Interp *interp, + int argc, char *argv[]) { kadm5_ret_t ret; int tcl_ret; @@ -1662,8 +1666,9 @@ int tcl_kadm5_destroy(ClientData clientData, Tcl_Interp *interp, return TCL_OK; } -int tcl_kadm5_create_principal(ClientData clientData, Tcl_Interp *interp, - int argc, char *argv[]) +static int tcl_kadm5_create_principal(ClientData clientData, + Tcl_Interp *interp, + int argc, char *argv[]) { int tcl_ret; kadm5_ret_t ret; @@ -1731,8 +1736,9 @@ finished: -int tcl_kadm5_delete_principal(ClientData clientData, Tcl_Interp *interp, - int argc, char *argv[]) +static int tcl_kadm5_delete_principal(ClientData clientData, + Tcl_Interp *interp, + int argc, char *argv[]) { krb5_principal princ; krb5_error_code krb5_ret; @@ -1745,7 +1751,7 @@ int tcl_kadm5_delete_principal(ClientData clientData, Tcl_Interp *interp, if((tcl_ret = parse_str(interp, argv[0], &name)) != TCL_OK) return tcl_ret; if(name != NULL) { - if (krb5_ret = krb5_parse_name(context, name, &princ)) { + if ((krb5_ret = krb5_parse_name(context, name, &princ))) { stash_error(interp, krb5_ret); Tcl_AppendElement(interp, "while parsing principal"); return TCL_ERROR; @@ -1768,8 +1774,9 @@ int tcl_kadm5_delete_principal(ClientData clientData, Tcl_Interp *interp, -int tcl_kadm5_modify_principal(ClientData clientData, Tcl_Interp *interp, - int argc, char *argv[]) +static int tcl_kadm5_modify_principal(ClientData clientData, + Tcl_Interp *interp, + int argc, char *argv[]) { char *princ_string; kadm5_principal_ent_t princ = 0; diff --git a/src/kadmin/testing/util/tcl_ovsec_kadm.c b/src/kadmin/testing/util/tcl_ovsec_kadm.c index 9e27e9209..6fe3d2f4f 100644 --- a/src/kadmin/testing/util/tcl_ovsec_kadm.c +++ b/src/kadmin/testing/util/tcl_ovsec_kadm.c @@ -166,10 +166,10 @@ static int remove_server_handle(Tcl_Interp *interp, char *name) return TCL_ERROR; \ } \ { \ - int tcl_ret; \ - if ((tcl_ret = get_server_handle(interp, argv[0], &server_handle)) \ + int htcl_ret; \ + if ((htcl_ret = get_server_handle(interp, argv[0], &server_handle)) \ != TCL_OK) { \ - return tcl_ret; \ + return htcl_ret; \ } \ } \ argv++, argc--; @@ -251,7 +251,8 @@ static void set_ok(Tcl_Interp *interp, char *string) static Tcl_DString *unparse_err(ovsec_kadm_ret_t code) { - char *code_string, *error_string; + char *code_string; + const char *error_string; Tcl_DString *dstring; switch (code) { @@ -372,10 +373,10 @@ static Tcl_DString *unparse_err(ovsec_kadm_ret_t code) case KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN: code_string = "KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN"; break; case EINVAL: code_string = "EINVAL"; break; case ENOENT: code_string = "ENOENT"; break; - default: fprintf(stderr, "**** CODE %d ***\n", code); code_string = "UNKNOWN"; break; + default: fprintf(stderr, "**** CODE %ld ***\n", (long) code); code_string = "UNKNOWN"; break; } - error_string = (char *) error_message(code); + error_string = error_message(code); if (! (dstring = (Tcl_DString *) malloc(sizeof(Tcl_DString)))) { fprintf(stderr, "Out of memory!\n"); @@ -576,7 +577,8 @@ static Tcl_DString *unparse_principal_ent(ovsec_kadm_principal_ent_t princ) /* code for krb5_parse_name that the pointer passed into */ /* it should be initialized to 0 if I want it do be */ /* allocated automatically. */ - if (krb5_ret = krb5_unparse_name(context, princ->principal, &tmp)) { + krb5_ret = krb5_unparse_name(context, princ->principal, &tmp); + if (krb5_ret) { /* XXX Do we want to return an error? Not sure. */ Tcl_DStringAppendElement(str, "[unparseable principal]"); } @@ -598,7 +600,8 @@ static Tcl_DString *unparse_principal_ent(ovsec_kadm_principal_ent_t princ) Tcl_DStringAppendElement(str, buf); tmp = 0; - if (krb5_ret = krb5_unparse_name(context, princ->mod_name, &tmp)) { + krb5_ret = krb5_unparse_name(context, princ->mod_name, &tmp); + if (krb5_ret) { /* XXX */ Tcl_DStringAppendElement(str, "[unparseable principal]"); } @@ -804,22 +807,22 @@ static Tcl_DString *unparse_policy_ent(ovsec_kadm_policy_ent_t policy) Tcl_DStringFree(tmp_dstring); free(tmp_dstring); - sprintf(buf, "%d", policy->pw_min_life); + sprintf(buf, "%ld", policy->pw_min_life); Tcl_DStringAppendElement(str, buf); - sprintf(buf, "%d", policy->pw_max_life); + sprintf(buf, "%ld", policy->pw_max_life); Tcl_DStringAppendElement(str, buf); - sprintf(buf, "%d", policy->pw_min_length); + sprintf(buf, "%ld", policy->pw_min_length); Tcl_DStringAppendElement(str, buf); - sprintf(buf, "%d", policy->pw_min_classes); + sprintf(buf, "%ld", policy->pw_min_classes); Tcl_DStringAppendElement(str, buf); - sprintf(buf, "%d", policy->pw_history_num); + sprintf(buf, "%ld", policy->pw_history_num); Tcl_DStringAppendElement(str, buf); - sprintf(buf, "%d", policy->policy_refcnt); + sprintf(buf, "%ld", policy->policy_refcnt); Tcl_DStringAppendElement(str, buf); return str; @@ -995,8 +998,8 @@ static Tcl_DString *unparse_keyblock(krb5_keyblock *keyblock) -int tcl_ovsec_kadm_init(ClientData clientData, Tcl_Interp *interp, - int argc, char *argv[]) +static int tcl_ovsec_kadm_init(ClientData clientData, Tcl_Interp *interp, + int argc, char *argv[]) { ovsec_kadm_ret_t ret; char *client_name, *pass, *service_name, *realm; @@ -1058,8 +1061,8 @@ int tcl_ovsec_kadm_init(ClientData clientData, Tcl_Interp *interp, -int tcl_ovsec_kadm_destroy(ClientData clientData, Tcl_Interp *interp, - int argc, char *argv[]) +static int tcl_ovsec_kadm_destroy(ClientData clientData, Tcl_Interp *interp, + int argc, char *argv[]) { ovsec_kadm_ret_t ret; int tcl_ret; @@ -1081,8 +1084,9 @@ int tcl_ovsec_kadm_destroy(ClientData clientData, Tcl_Interp *interp, return TCL_OK; } -int tcl_ovsec_kadm_create_principal(ClientData clientData, Tcl_Interp *interp, - int argc, char *argv[]) +static int tcl_ovsec_kadm_create_principal(ClientData clientData, + Tcl_Interp *interp, + int argc, char *argv[]) { int tcl_ret; ovsec_kadm_ret_t ret; @@ -1150,8 +1154,9 @@ finished: -int tcl_ovsec_kadm_delete_principal(ClientData clientData, Tcl_Interp *interp, - int argc, char *argv[]) +static int tcl_ovsec_kadm_delete_principal(ClientData clientData, + Tcl_Interp *interp, + int argc, char *argv[]) { krb5_principal princ; krb5_error_code krb5_ret; @@ -1164,7 +1169,8 @@ int tcl_ovsec_kadm_delete_principal(ClientData clientData, Tcl_Interp *interp, if((tcl_ret = parse_str(interp, argv[0], &name)) != TCL_OK) return tcl_ret; if(name != NULL) { - if (krb5_ret = krb5_parse_name(context, name, &princ)) { + krb5_ret = krb5_parse_name(context, name, &princ); + if (krb5_ret) { stash_error(interp, krb5_ret); Tcl_AppendElement(interp, "while parsing principal"); return TCL_ERROR; @@ -1187,8 +1193,9 @@ int tcl_ovsec_kadm_delete_principal(ClientData clientData, Tcl_Interp *interp, -int tcl_ovsec_kadm_modify_principal(ClientData clientData, Tcl_Interp *interp, - int argc, char *argv[]) +static int tcl_ovsec_kadm_modify_principal(ClientData clientData, + Tcl_Interp *interp, + int argc, char *argv[]) { char *princ_string; ovsec_kadm_principal_ent_t princ = 0; @@ -1233,8 +1240,9 @@ finished: } -int tcl_ovsec_kadm_rename_principal(ClientData clientData, Tcl_Interp *interp, - int argc, char *argv[]) +static int tcl_ovsec_kadm_rename_principal(ClientData clientData, + Tcl_Interp *interp, + int argc, char *argv[]) { krb5_principal source, target; krb5_error_code krb5_ret; @@ -1243,13 +1251,15 @@ int tcl_ovsec_kadm_rename_principal(ClientData clientData, Tcl_Interp *interp, GET_HANDLE(2, 0); - if (krb5_ret = krb5_parse_name(context, argv[0], &source)) { + krb5_ret = krb5_parse_name(context, argv[0], &source); + if (krb5_ret) { stash_error(interp, krb5_ret); Tcl_AppendElement(interp, "while parsing source"); return TCL_ERROR; } - if (krb5_ret = krb5_parse_name(context, argv[1], &target)) { + krb5_ret = krb5_parse_name(context, argv[1], &target); + if (krb5_ret) { stash_error(interp, krb5_ret); Tcl_AppendElement(interp, "while parsing target"); krb5_free_principal(context, source); @@ -1273,8 +1283,9 @@ int tcl_ovsec_kadm_rename_principal(ClientData clientData, Tcl_Interp *interp, -int tcl_ovsec_kadm_chpass_principal(ClientData clientData, Tcl_Interp *interp, - int argc, char *argv[]) +static int tcl_ovsec_kadm_chpass_principal(ClientData clientData, + Tcl_Interp *interp, + int argc, char *argv[]) { krb5_principal princ; char *pw; @@ -1288,7 +1299,8 @@ int tcl_ovsec_kadm_chpass_principal(ClientData clientData, Tcl_Interp *interp, GET_HANDLE(2, 0); - if (krb5_ret = krb5_parse_name(context, argv[0], &princ)) { + krb5_ret = krb5_parse_name(context, argv[0], &princ); + if (krb5_ret) { stash_error(interp, krb5_ret); Tcl_AppendElement(interp, "while parsing principal name"); return TCL_ERROR; @@ -1330,9 +1342,9 @@ finished: -int tcl_ovsec_kadm_chpass_principal_util(ClientData clientData, - Tcl_Interp *interp, - int argc, char *argv[]) +static int tcl_ovsec_kadm_chpass_principal_util(ClientData clientData, + Tcl_Interp *interp, + int argc, char *argv[]) { krb5_principal princ; char *new_pw; @@ -1348,7 +1360,7 @@ int tcl_ovsec_kadm_chpass_principal_util(ClientData clientData, GET_HANDLE(4, 0); - if (krb5_ret = krb5_parse_name(context, argv[0], &princ)) { + if ((krb5_ret = krb5_parse_name(context, argv[0], &princ))) { stash_error(interp, krb5_ret); Tcl_AppendElement(interp, "while parsing principal name"); return TCL_ERROR; @@ -1416,8 +1428,9 @@ finished: -int tcl_ovsec_kadm_randkey_principal(ClientData clientData, Tcl_Interp *interp, - int argc, char *argv[]) +static int tcl_ovsec_kadm_randkey_principal(ClientData clientData, + Tcl_Interp *interp, + int argc, char *argv[]) { krb5_principal princ; krb5_keyblock *keyblock; @@ -1433,7 +1446,7 @@ int tcl_ovsec_kadm_randkey_principal(ClientData clientData, Tcl_Interp *interp, GET_HANDLE(2, 0); - if (krb5_ret = krb5_parse_name(context, argv[0], &princ)) { + if ((krb5_ret = krb5_parse_name(context, argv[0], &princ))) { stash_error(interp, krb5_ret); Tcl_AppendElement(interp, "while parsing principal name"); return TCL_ERROR; @@ -1491,8 +1504,9 @@ finished: -int tcl_ovsec_kadm_get_principal(ClientData clientData, Tcl_Interp *interp, - int argc, char *argv[]) +static int tcl_ovsec_kadm_get_principal(ClientData clientData, + Tcl_Interp *interp, + int argc, char *argv[]) { krb5_principal princ; ovsec_kadm_principal_ent_t ent; @@ -1509,7 +1523,7 @@ int tcl_ovsec_kadm_get_principal(ClientData clientData, Tcl_Interp *interp, if((tcl_ret = parse_str(interp, argv[0], &name)) != TCL_OK) return tcl_ret; if(name != NULL) { - if (krb5_ret = krb5_parse_name(context, name, &princ)) { + if ((krb5_ret = krb5_parse_name(context, name, &princ))) { stash_error(interp, ret); Tcl_AppendElement(interp, "while parsing principal name"); return TCL_ERROR; @@ -1594,8 +1608,9 @@ finished: return retcode; } -int tcl_ovsec_kadm_create_policy(ClientData clientData, Tcl_Interp *interp, - int argc, char *argv[]) +static int tcl_ovsec_kadm_create_policy(ClientData clientData, + Tcl_Interp *interp, + int argc, char *argv[]) { int tcl_ret; ovsec_kadm_ret_t ret; @@ -1642,11 +1657,10 @@ finished: -int tcl_ovsec_kadm_delete_policy(ClientData clientData, Tcl_Interp *interp, - int argc, char *argv[]) +static int tcl_ovsec_kadm_delete_policy(ClientData clientData, + Tcl_Interp *interp, + int argc, char *argv[]) { - krb5_principal princ; - krb5_error_code krb5_ret; ovsec_kadm_ret_t ret; char *policy; int tcl_ret; @@ -1672,8 +1686,9 @@ int tcl_ovsec_kadm_delete_policy(ClientData clientData, Tcl_Interp *interp, -int tcl_ovsec_kadm_modify_policy(ClientData clientData, Tcl_Interp *interp, - int argc, char *argv[]) +static int tcl_ovsec_kadm_modify_policy(ClientData clientData, + Tcl_Interp *interp, + int argc, char *argv[]) { char *policy_string; ovsec_kadm_policy_ent_t policy = 0; @@ -1718,8 +1733,9 @@ finished: } -int tcl_ovsec_kadm_get_policy(ClientData clientData, Tcl_Interp *interp, - int argc, char *argv[]) +static int tcl_ovsec_kadm_get_policy(ClientData clientData, + Tcl_Interp *interp, + int argc, char *argv[]) { ovsec_kadm_policy_ent_t ent; Tcl_DString *ent_dstring = 0; @@ -1813,9 +1829,9 @@ finished: -int tcl_ovsec_kadm_free_principal_ent(ClientData clientData, - Tcl_Interp *interp, - int argc, char *argv[]) +static int tcl_ovsec_kadm_free_principal_ent(ClientData clientData, + Tcl_Interp *interp, + int argc, char *argv[]) { char *ent_name; ovsec_kadm_principal_ent_t ent; @@ -1858,7 +1874,7 @@ int tcl_ovsec_kadm_free_principal_ent(ClientData clientData, ent = (ovsec_kadm_principal_ent_t) Tcl_GetHashValue(entry); - if (ret = ovsec_kadm_free_principal_ent(server_handle, ent)) { + if ((ret = ovsec_kadm_free_principal_ent(server_handle, ent))) { stash_error(interp, ret); return TCL_ERROR; } @@ -1869,9 +1885,9 @@ int tcl_ovsec_kadm_free_principal_ent(ClientData clientData, } -int tcl_ovsec_kadm_free_policy_ent(ClientData clientData, - Tcl_Interp *interp, - int argc, char *argv[]) +static int tcl_ovsec_kadm_free_policy_ent(ClientData clientData, + Tcl_Interp *interp, + int argc, char *argv[]) { char *ent_name; ovsec_kadm_policy_ent_t ent; @@ -1914,7 +1930,7 @@ int tcl_ovsec_kadm_free_policy_ent(ClientData clientData, ent = (ovsec_kadm_policy_ent_t) Tcl_GetHashValue(entry); - if (ret = ovsec_kadm_free_policy_ent(server_handle, ent)) { + if ((ret = ovsec_kadm_free_policy_ent(server_handle, ent))) { stash_error(interp, ret); return TCL_ERROR; } @@ -1925,8 +1941,8 @@ int tcl_ovsec_kadm_free_policy_ent(ClientData clientData, } -int tcl_ovsec_kadm_get_privs(ClientData clientData, Tcl_Interp *interp, - int argc, char *argv[]) +static int tcl_ovsec_kadm_get_privs(ClientData clientData, Tcl_Interp *interp, + int argc, char *argv[]) { int tcl_ret; char *set_ret;