mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
s3:libads: remove unused kerberos_secrets_store_salting_principal()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12782 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
parent
4260b52a39
commit
c56043a94a
@ -433,78 +433,6 @@ int create_kerberos_key_from_string(krb5_context context,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
Routine to set the salting principal for this service. Active
|
||||
Directory may use a non-obvious principal name to generate the salt
|
||||
when it determines the key to use for encrypting tickets for a service,
|
||||
and hopefully we detected that when we joined the domain.
|
||||
Setting principal to NULL deletes this entry.
|
||||
************************************************************************/
|
||||
|
||||
bool kerberos_secrets_store_salting_principal(const char *service,
|
||||
int enctype,
|
||||
const char *principal)
|
||||
{
|
||||
char *key = NULL;
|
||||
bool ret = False;
|
||||
krb5_context context = NULL;
|
||||
krb5_principal princ = NULL;
|
||||
char *princ_s = NULL;
|
||||
char *unparsed_name = NULL;
|
||||
krb5_error_code code;
|
||||
|
||||
if (((code = krb5_init_context(&context)) != 0) || (context == NULL)) {
|
||||
DEBUG(5, ("kerberos_secrets_store_salting_pricipal: kdb5_init_context failed: %s\n",
|
||||
error_message(code)));
|
||||
return False;
|
||||
}
|
||||
if (strchr_m(service, '@')) {
|
||||
if (asprintf(&princ_s, "%s", service) == -1) {
|
||||
goto out;
|
||||
}
|
||||
} else {
|
||||
if (asprintf(&princ_s, "%s@%s", service, lp_realm()) == -1) {
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
if (smb_krb5_parse_name(context, princ_s, &princ) != 0) {
|
||||
goto out;
|
||||
}
|
||||
if (smb_krb5_unparse_name(talloc_tos(), context, princ, &unparsed_name) != 0) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (asprintf(&key, "%s/%s/enctype=%d",
|
||||
SECRETS_SALTING_PRINCIPAL, unparsed_name, enctype)
|
||||
== -1) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
if ((principal != NULL) && (strlen(principal) > 0)) {
|
||||
ret = secrets_store(key, principal, strlen(principal) + 1);
|
||||
} else {
|
||||
ret = secrets_delete(key);
|
||||
}
|
||||
|
||||
out:
|
||||
|
||||
SAFE_FREE(key);
|
||||
SAFE_FREE(princ_s);
|
||||
TALLOC_FREE(unparsed_name);
|
||||
|
||||
if (princ) {
|
||||
krb5_free_principal(context, princ);
|
||||
}
|
||||
|
||||
if (context) {
|
||||
krb5_free_context(context);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************
|
||||
************************************************************************/
|
||||
|
||||
|
@ -62,9 +62,6 @@ char *kerberos_fetch_salt_princ_for_host_princ(krb5_context context,
|
||||
const char *host_princ_s,
|
||||
int enctype);
|
||||
|
||||
bool kerberos_secrets_store_salting_principal(const char *service,
|
||||
int enctype,
|
||||
const char *principal);
|
||||
int kerberos_kinit_password(const char *principal,
|
||||
const char *password,
|
||||
int time_offset,
|
||||
|
Loading…
Reference in New Issue
Block a user