OM_uint32 minor_stat;
kadm5_server_handle_t handle;
restriction_t *rp;
- const char *errmsg;
+ const char *errmsg = NULL;
xdr_free(xdr_generic_ret, &ret);
ret.code = kadm5_create_principal((void *)handle,
&arg->rec, arg->mask,
arg->passwd);
- if( ret.code == 0 )
- errmsg = "success";
- else
+
+ if( ret.code != 0 )
errmsg = krb5_get_error_message(handle ? handle->context : NULL, ret.code);
- log_done("kadm5_create_principal", prime_arg, errmsg,
+ log_done("kadm5_create_principal", prime_arg,
+ errmsg ? errmsg : "success",
&client_name, &service_name, rqstp);
- /* no need to check for NULL. Even if it is NULL, atleast error_code will be returned */
+ if (errmsg != NULL)
+ krb5_free_error_message(handle ? handle->context : NULL, errmsg);
}
free_server_handle(handle);
free(prime_arg);
OM_uint32 minor_stat;
kadm5_server_handle_t handle;
restriction_t *rp;
- const char *errmsg;
+ const char *errmsg = NULL;
xdr_free(xdr_generic_ret, &ret);
arg->n_ks_tuple,
arg->ks_tuple,
arg->passwd);
- if( ret.code == 0 )
- errmsg = "success";
- else
+ if( ret.code != 0 )
errmsg = krb5_get_error_message(handle ? handle->context : NULL, ret.code);
- log_done("kadm5_create_principal", prime_arg, errmsg,
+ log_done("kadm5_create_principal", prime_arg,
+ errmsg ? errmsg : "success",
&client_name, &service_name, rqstp);
- /* no need to check for NULL. Even if it is NULL, atleast error_code will be returned */
+ if (errmsg != NULL)
+ krb5_free_error_message(handle ? handle->context : NULL, errmsg);
}
free_server_handle(handle);
free(prime_arg);
service_name;
OM_uint32 minor_stat;
kadm5_server_handle_t handle;
- const char *errmsg;
+ const char *errmsg = NULL;
xdr_free(xdr_generic_ret, &ret);
&client_name, &service_name, rqstp);
} else {
ret.code = kadm5_delete_principal((void *)handle, arg->princ);
- if( ret.code == 0 )
- errmsg = "success";
- else
+ if( ret.code != 0 )
errmsg = krb5_get_error_message(handle ? handle->context : NULL, ret.code);
- log_done("kadm5_delete_principal", prime_arg, errmsg,
+ log_done("kadm5_delete_principal", prime_arg,
+ errmsg ? errmsg : "success",
&client_name, &service_name, rqstp);
- /* no need to check for NULL. Even if it is NULL, atleast error_code will be returned */
+ if (errmsg != NULL)
+ krb5_free_error_message(handle ? handle->context : NULL, errmsg);
+
}
free(prime_arg);
free_server_handle(handle);
OM_uint32 minor_stat;
kadm5_server_handle_t handle;
restriction_t *rp;
- const char *errmsg;
+ const char *errmsg = NULL;
xdr_free(xdr_generic_ret, &ret);
} else {
ret.code = kadm5_modify_principal((void *)handle, &arg->rec,
arg->mask);
- if( ret.code == 0 )
- errmsg = "success";
- else
+ if( ret.code != 0 )
errmsg = krb5_get_error_message(handle ? handle->context : NULL, ret.code);
- log_done("kadm5_modify_principal", prime_arg, errmsg,
+ log_done("kadm5_modify_principal", prime_arg,
+ errmsg ? errmsg : "success",
&client_name, &service_name, rqstp);
- /* no need to check for NULL. Even if it is NULL, atleast error_code will be returned */
+ if (errmsg != NULL)
+ krb5_free_error_message(handle ? handle->context : NULL, errmsg);
}
free_server_handle(handle);
free(prime_arg);
OM_uint32 minor_stat;
kadm5_server_handle_t handle;
restriction_t *rp;
- const char *errmsg;
+ const char *errmsg = NULL;
size_t tlen1, tlen2, clen, slen;
char *tdots1, *tdots2, *cdots, *sdots;
} else {
ret.code = kadm5_rename_principal((void *)handle, arg->src,
arg->dest);
- if( ret.code == 0 )
- errmsg = "success";
- else
+ if( ret.code != 0 )
errmsg = krb5_get_error_message(handle ? handle->context : NULL, ret.code);
/* okay to cast lengths to int because trunc_name limits max value */
"%.*s%s to %.*s%s, %s, "
"client=%.*s%s, service=%.*s%s, addr=%s",
(int)tlen1, prime_arg1, tdots1,
- (int)tlen2, prime_arg2, tdots2, errmsg,
+ (int)tlen2, prime_arg2, tdots2,
+ errmsg ? errmsg : "success",
(int)clen, (char *)client_name.value, cdots,
(int)slen, (char *)service_name.value, sdots,
inet_ntoa(rqstp->rq_xprt->xp_raddr.sin_addr));
+
+ if (errmsg != NULL)
+ krb5_free_error_message(handle ? handle->context : NULL, errmsg);
+
}
free_server_handle(handle);
free(prime_arg1);
service_name;
OM_uint32 minor_stat;
kadm5_server_handle_t handle;
- const char *errmsg;
+ const char *errmsg = NULL;
xdr_free(xdr_gprinc_ret, &ret);
arg->mask);
}
- if( ret.code == 0 )
- errmsg = "success";
- else
+ if( ret.code != 0 )
errmsg = krb5_get_error_message(handle ? handle->context : NULL, ret.code);
- log_done(funcname, prime_arg, errmsg,
+ log_done(funcname, prime_arg, errmsg ? errmsg : "success",
&client_name, &service_name, rqstp);
+ if (errmsg != NULL)
+ krb5_free_error_message(handle ? handle->context : NULL, errmsg);
}
free_server_handle(handle);
free(prime_arg);
service_name;
OM_uint32 minor_stat;
kadm5_server_handle_t handle;
- const char *errmsg;
+ const char *errmsg = NULL;
xdr_free(xdr_gprincs_ret, &ret);
ret.code = kadm5_get_principals((void *)handle,
arg->exp, &ret.princs,
&ret.count);
- if( ret.code == 0 )
- errmsg = "success";
- else
+ if( ret.code != 0 )
errmsg = krb5_get_error_message(handle ? handle->context : NULL, ret.code);
- log_done("kadm5_get_principals", prime_arg, errmsg,
+ log_done("kadm5_get_principals", prime_arg,
+ errmsg ? errmsg : "success",
&client_name, &service_name, rqstp);
+ if (errmsg != NULL)
+ krb5_free_error_message(handle ? handle->context : NULL, errmsg);
+
}
free_server_handle(handle);
gss_release_buffer(&minor_stat, &client_name);
service_name;
OM_uint32 minor_stat;
kadm5_server_handle_t handle;
- const char *errmsg;
+ const char *errmsg = NULL;
xdr_free(xdr_generic_ret, &ret);
ret.code = KADM5_AUTH_CHANGEPW;
}
- if(ret.code != KADM5_AUTH_CHANGEPW) {
- if( ret.code == 0 )
- errmsg = "success";
- else
+ if (ret.code != KADM5_AUTH_CHANGEPW) {
+ if (ret.code != 0)
errmsg = krb5_get_error_message(handle ? handle->context : NULL, ret.code);
- log_done("kadm5_chpass_principal", prime_arg, errmsg,
+ log_done("kadm5_chpass_principal", prime_arg,
+ errmsg ? errmsg : "success",
&client_name, &service_name, rqstp);
+
+ if (errmsg != NULL)
+ krb5_free_error_message(handle ? handle->context : NULL, errmsg);
}
free_server_handle(handle);
service_name;
OM_uint32 minor_stat;
kadm5_server_handle_t handle;
- const char *errmsg;
+ const char *errmsg = NULL;
xdr_free(xdr_generic_ret, &ret);
}
if(ret.code != KADM5_AUTH_CHANGEPW) {
- if( ret.code == 0 )
- errmsg = "success";
- else
+ if( ret.code != 0 )
errmsg = krb5_get_error_message(handle ? handle->context : NULL, ret.code);
- log_done("kadm5_chpass_principal", prime_arg, errmsg,
+ log_done("kadm5_chpass_principal", prime_arg,
+ errmsg ? errmsg : "success",
&client_name, &service_name, rqstp);
+
+ if (errmsg != NULL)
+ krb5_free_error_message(handle ? handle->context : NULL, errmsg);
}
free_server_handle(handle);
service_name;
OM_uint32 minor_stat;
kadm5_server_handle_t handle;
- const char *errmsg;
+ const char *errmsg = NULL;
xdr_free(xdr_generic_ret, &ret);
}
if(ret.code != KADM5_AUTH_SETKEY) {
- if( ret.code == 0 )
- errmsg = "success";
- else
+ if( ret.code != 0 )
errmsg = krb5_get_error_message(handle ? handle->context : NULL, ret.code);
- log_done("kadm5_setv4key_principal", prime_arg, errmsg,
+ log_done("kadm5_setv4key_principal", prime_arg,
+ errmsg ? errmsg : "success",
&client_name, &service_name, rqstp);
+
+ if (errmsg != NULL)
+ krb5_free_error_message(handle ? handle->context : NULL, errmsg);
}
free_server_handle(handle);
service_name;
OM_uint32 minor_stat;
kadm5_server_handle_t handle;
- const char *errmsg;
+ const char *errmsg = NULL;
xdr_free(xdr_generic_ret, &ret);
}
if(ret.code != KADM5_AUTH_SETKEY) {
- if( ret.code == 0 )
- errmsg = "success";
- else
+ if( ret.code != 0 )
errmsg = krb5_get_error_message(handle ? handle->context : NULL, ret.code);
- log_done("kadm5_setkey_principal", prime_arg, errmsg,
+ log_done("kadm5_setkey_principal", prime_arg,
+ errmsg ? errmsg : "success",
&client_name, &service_name, rqstp);
+
+ if (errmsg != NULL)
+ krb5_free_error_message(handle ? handle->context : NULL, errmsg);
}
free_server_handle(handle);
service_name;
OM_uint32 minor_stat;
kadm5_server_handle_t handle;
- const char *errmsg;
+ const char *errmsg = NULL;
xdr_free(xdr_generic_ret, &ret);
}
if(ret.code != KADM5_AUTH_SETKEY) {
- if( ret.code == 0 )
- errmsg = "success";
- else
+ if( ret.code != 0 )
errmsg = krb5_get_error_message(handle ? handle->context : NULL, ret.code);
- log_done("kadm5_setkey_principal", prime_arg, errmsg,
+ log_done("kadm5_setkey_principal", prime_arg,
+ errmsg ? errmsg : "success",
&client_name, &service_name, rqstp);
+
+ if (errmsg != NULL)
+ krb5_free_error_message(handle ? handle->context : NULL, errmsg);
}
free_server_handle(handle);
service_name;
OM_uint32 minor_stat;
kadm5_server_handle_t handle;
- const char *errmsg;
+ const char *errmsg = NULL;
xdr_free(xdr_chrand_ret, &ret);
}
if(ret.code != KADM5_AUTH_CHANGEPW) {
- if( ret.code == 0 )
- errmsg = "success";
- else
+ if( ret.code != 0 )
errmsg = krb5_get_error_message(handle ? handle->context : NULL, ret.code);
- log_done(funcname, prime_arg, errmsg,
+ log_done(funcname, prime_arg, errmsg ? errmsg : "success",
&client_name, &service_name, rqstp);
+
+ if (errmsg != NULL)
+ krb5_free_error_message(handle ? handle->context : NULL, errmsg);
}
free_server_handle(handle);
free(prime_arg);
service_name;
OM_uint32 minor_stat;
kadm5_server_handle_t handle;
- const char *errmsg;
+ const char *errmsg = NULL;
xdr_free(xdr_chrand_ret, &ret);
}
if(ret.code != KADM5_AUTH_CHANGEPW) {
- if( ret.code == 0 )
- errmsg = "success";
- else
+ if( ret.code != 0 )
errmsg = krb5_get_error_message(handle ? handle->context : NULL, ret.code);
- log_done(funcname, prime_arg, errmsg,
+ log_done(funcname, prime_arg, errmsg ? errmsg : "success",
&client_name, &service_name, rqstp);
+
+ if (errmsg != NULL)
+ krb5_free_error_message(handle ? handle->context : NULL, errmsg);
}
free_server_handle(handle);
free(prime_arg);
service_name;
OM_uint32 minor_stat;
kadm5_server_handle_t handle;
- const char *errmsg;
+ const char *errmsg = NULL;
xdr_free(xdr_generic_ret, &ret);
} else {
ret.code = kadm5_create_policy((void *)handle, &arg->rec,
arg->mask);
- if( ret.code == 0 )
- errmsg = "success";
- else
+ if( ret.code != 0 )
errmsg = krb5_get_error_message(handle ? handle->context : NULL, ret.code);
log_done("kadm5_create_policy",
- ((prime_arg == NULL) ? "(null)" : prime_arg), errmsg,
+ ((prime_arg == NULL) ? "(null)" : prime_arg),
+ errmsg ? errmsg : "success",
&client_name, &service_name, rqstp);
+
+ if (errmsg != NULL)
+ krb5_free_error_message(handle ? handle->context : NULL, errmsg);
}
free_server_handle(handle);
gss_release_buffer(&minor_stat, &client_name);
service_name;
OM_uint32 minor_stat;
kadm5_server_handle_t handle;
- const char *errmsg;
+ const char *errmsg = NULL;
xdr_free(xdr_generic_ret, &ret);
ret.code = KADM5_AUTH_DELETE;
} else {
ret.code = kadm5_delete_policy((void *)handle, arg->name);
- if( ret.code == 0 )
- errmsg = "success";
- else
+ if( ret.code != 0 )
errmsg = krb5_get_error_message(handle ? handle->context : NULL, ret.code);
log_done("kadm5_delete_policy",
- ((prime_arg == NULL) ? "(null)" : prime_arg), errmsg,
+ ((prime_arg == NULL) ? "(null)" : prime_arg),
+ errmsg ? errmsg : "success",
&client_name, &service_name, rqstp);
+
+ if (errmsg != NULL)
+ krb5_free_error_message(handle ? handle->context : NULL, errmsg);
}
free_server_handle(handle);
gss_release_buffer(&minor_stat, &client_name);
service_name;
OM_uint32 minor_stat;
kadm5_server_handle_t handle;
- const char *errmsg;
+ const char *errmsg = NULL;
xdr_free(xdr_generic_ret, &ret);
} else {
ret.code = kadm5_modify_policy((void *)handle, &arg->rec,
arg->mask);
- if( ret.code == 0 )
- errmsg = "success";
- else
+ if( ret.code != 0 )
errmsg = krb5_get_error_message(handle ? handle->context : NULL, ret.code);
log_done("kadm5_modify_policy",
- ((prime_arg == NULL) ? "(null)" : prime_arg), errmsg,
+ ((prime_arg == NULL) ? "(null)" : prime_arg),
+ errmsg ? errmsg : "success",
&client_name, &service_name, rqstp);
+
+ if (errmsg != NULL)
+ krb5_free_error_message(handle ? handle->context : NULL, errmsg);
}
free_server_handle(handle);
gss_release_buffer(&minor_stat, &client_name);
kadm5_policy_ent_t e;
kadm5_principal_ent_rec caller_ent;
kadm5_server_handle_t handle;
- const char *errmsg;
+ const char *errmsg = NULL;
xdr_free(xdr_gpol_ret, &ret);
&ret.rec);
}
- if( ret.code == 0 )
- errmsg = "success";
- else
+ if( ret.code != 0 )
errmsg = krb5_get_error_message(handle ? handle->context : NULL, ret.code);
log_done(funcname,
- ((prime_arg == NULL) ? "(null)" : prime_arg), errmsg,
+ ((prime_arg == NULL) ? "(null)" : prime_arg),
+ errmsg ? errmsg : "success",
&client_name, &service_name, rqstp);
+ if (errmsg != NULL)
+ krb5_free_error_message(handle ? handle->context : NULL, errmsg);
+
} else {
log_unauth(funcname, prime_arg,
&client_name, &service_name, rqstp);
service_name;
OM_uint32 minor_stat;
kadm5_server_handle_t handle;
- const char *errmsg;
+ const char *errmsg = NULL;
xdr_free(xdr_gpols_ret, &ret);
ret.code = kadm5_get_policies((void *)handle,
arg->exp, &ret.pols,
&ret.count);
- if( ret.code == 0 )
- errmsg = "success";
- else
+ if( ret.code != 0 )
errmsg = krb5_get_error_message(handle ? handle->context : NULL, ret.code);
- log_done("kadm5_get_policies", prime_arg, errmsg,
+ log_done("kadm5_get_policies", prime_arg,
+ errmsg ? errmsg : "success",
&client_name, &service_name, rqstp);
+
+ if (errmsg != NULL)
+ krb5_free_error_message(handle ? handle->context : NULL, errmsg);
}
free_server_handle(handle);
gss_release_buffer(&minor_stat, &client_name);
gss_buffer_desc client_name, service_name;
OM_uint32 minor_stat;
kadm5_server_handle_t handle;
- const char *errmsg;
+ const char *errmsg = NULL;
xdr_free(xdr_getprivs_ret, &ret);
}
ret.code = kadm5_get_privs((void *)handle, &ret.privs);
- if( ret.code == 0 )
- errmsg = "success";
- else
+ if( ret.code != 0 )
errmsg = krb5_get_error_message(handle ? handle->context : NULL, ret.code);
- log_done("kadm5_get_privs", client_name.value, errmsg,
+ log_done("kadm5_get_privs", client_name.value,
+ errmsg ? errmsg : "success",
&client_name, &service_name, rqstp);
+ if (errmsg != NULL)
+ krb5_free_error_message(handle ? handle->context : NULL, errmsg);
+
free_server_handle(handle);
gss_release_buffer(&minor_stat, &client_name);
gss_release_buffer(&minor_stat, &service_name);
service_name;
kadm5_server_handle_t handle;
OM_uint32 minor_stat;
- const char *errmsg = NULL;
+ const char *errmsg = NULL;
size_t clen, slen;
char *cdots, *sdots;
if (ret.code != 0)
errmsg = krb5_get_error_message(NULL, ret.code);
- else
- errmsg = "success";
clen = client_name.length;
trunc_name(&clen, &cdots);
"client=%.*s%s, service=%.*s%s, addr=%s, flavor=%d",
(ret.api_version == KADM5_API_VERSION_1 ?
"kadm5_init (V1)" : "kadm5_init"),
- (int)clen, (char *)client_name.value, cdots, errmsg,
+ (int)clen, (char *)client_name.value, cdots,
+ errmsg ? errmsg : "success",
(int)clen, (char *)client_name.value, cdots,
(int)slen, (char *)service_name.value, sdots,
inet_ntoa(rqstp->rq_xprt->xp_raddr.sin_addr),
rqstp->rq_cred.oa_flavor);
+ if (errmsg != NULL)
+ krb5_free_error_message(handle ? handle->context : NULL, errmsg);
gss_release_buffer(&minor_stat, &client_name);
gss_release_buffer(&minor_stat, &service_name);