enctypes[i],
KRB5_KT_KEY(&entry));
if (ret != 0) {
+ *error_string = talloc_strdup(parent_ctx,
+ "Failed to create key from string");
return ret;
}
krb5_context context,
krb5_keytab keytab,
bool add_old,
- const char **error_string)
+ const char **perror_string)
{
krb5_error_code ret;
krb5_principal salt_princ = NULL;
krb5_enctype *enctypes;
TALLOC_CTX *mem_ctx;
+ const char *error_string = NULL;
if (!new_secret) {
/* There is no password here, so nothing to do */
mem_ctx = talloc_new(parent_ctx);
if (!mem_ctx) {
- *error_string = talloc_strdup(parent_ctx,
+ *perror_string = talloc_strdup(parent_ctx,
"unable to allocate tmp_ctx for create_keytab");
return ENOMEM;
}
* fetch that */
ret = krb5_parse_name(context, saltPrincipal, &salt_princ);
if (ret) {
- *error_string = smb_get_krb5_error_message(context,
+ *perror_string = smb_get_krb5_error_message(context,
ret,
parent_ctx);
talloc_free(mem_ctx);
ret = ms_suptypes_to_ietf_enctypes(mem_ctx, supp_enctypes, &enctypes);
if (ret) {
- *error_string = talloc_asprintf(parent_ctx,
+ *perror_string = talloc_asprintf(parent_ctx,
"create_keytab: generating list of "
"encryption types failed (%s)\n",
smb_get_krb5_error_message(context,
num_principals,
principals,
salt_princ, kvno, new_secret,
- context, enctypes, keytab, error_string);
+ context, enctypes, keytab, &error_string);
if (ret) {
- talloc_steal(parent_ctx, *error_string);
+ *perror_string = talloc_steal(parent_ctx, error_string);
goto done;
}
num_principals,
principals,
salt_princ, kvno - 1, old_secret,
- context, enctypes, keytab, error_string);
+ context, enctypes, keytab, &error_string);
if (ret) {
- talloc_steal(parent_ctx, *error_string);
+ *perror_string = talloc_steal(parent_ctx, error_string);
}
}
uint32_t supp_enctypes,
bool delete_all_kvno,
krb5_keytab *_keytab,
- const char **error_string)
+ const char **perror_string)
{
krb5_keytab keytab;
krb5_error_code ret;
krb5_principal *principals = NULL;
uint32_t num_principals = 0;
char *upper_realm;
+ const char *error_string = NULL;
if (keytab_name == NULL) {
return ENOENT;
}
if (saltPrincipal == NULL) {
- *error_string = "No saltPrincipal provided";
+ *perror_string = talloc_strdup(parent_ctx,
+ "No saltPrincipal provided");
return EINVAL;
}
ret = krb5_kt_resolve(context, keytab_name, &keytab);
if (ret) {
- *error_string = smb_get_krb5_error_message(context,
+ *perror_string = smb_get_krb5_error_message(context,
ret, parent_ctx);
return ret;
}
tmp_ctx = talloc_new(parent_ctx);
if (!tmp_ctx) {
+ *perror_string = talloc_strdup(parent_ctx,
+ "Failed to allocate memory context");
return ENOMEM;
}
upper_realm = strupper_talloc(tmp_ctx, realm);
if (upper_realm == NULL) {
- *error_string = "Cannot allocate memory to upper case realm";
+ *perror_string = talloc_strdup(parent_ctx,
+ "Cannot allocate memory to upper case realm");
talloc_free(tmp_ctx);
return ENOMEM;
}
SPNs,
&num_principals,
&principals,
- error_string);
+ &error_string);
if (ret != 0) {
- *error_string = talloc_asprintf(parent_ctx,
+ *perror_string = talloc_asprintf(parent_ctx,
"Failed to load principals from ldb message: %s\n",
- *error_string);
+ error_string);
goto done;
}
principals,
kvno,
&found_previous,
- error_string);
+ &error_string);
if (ret != 0) {
- *error_string = talloc_asprintf(parent_ctx,
+ *perror_string = talloc_asprintf(parent_ctx,
"Failed to remove old principals from keytab: %s\n",
- *error_string);
+ error_string);
goto done;
}
principals,
context, keytab,
found_previous ? false : true,
- error_string);
+ &error_string);
if (ret) {
- talloc_steal(parent_ctx, *error_string);
+ *perror_string = talloc_steal(parent_ctx, error_string);
}
}
krb5_error_code ret;
TALLOC_CTX *mem_ctx = talloc_new(parent_ctx);
const char *rand_string;
- const char *error_string;
+ const char *error_string = NULL;
if (!mem_ctx) {
return ENOMEM;
}