diff options
author | Jeremy Allison <jeremy@jeremy-desktop.(none)> | 2008-12-23 11:56:48 -0800 |
---|---|---|
committer | Jeremy Allison <jeremy@jeremy-desktop.(none)> | 2008-12-23 11:56:48 -0800 |
commit | 1966a947d3f8d432d3af5a9c0004e27561ae7f65 (patch) | |
tree | ab3bc78c9223c676536f268b8633eef8c5eb6613 /source3/libads/kerberos_keytab.c | |
parent | 94df767f21003507f01b9b08d7c52b5b8819977f (diff) | |
download | samba-1966a947d3f8d432d3af5a9c0004e27561ae7f65.tar.gz samba-1966a947d3f8d432d3af5a9c0004e27561ae7f65.tar.bz2 samba-1966a947d3f8d432d3af5a9c0004e27561ae7f65.zip |
More asprintf warning fixes.
Jeremy.
Diffstat (limited to 'source3/libads/kerberos_keytab.c')
-rw-r--r-- | source3/libads/kerberos_keytab.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/source3/libads/kerberos_keytab.c b/source3/libads/kerberos_keytab.c index c4e67091dd..7c028cb78f 100644 --- a/source3/libads/kerberos_keytab.c +++ b/source3/libads/kerberos_keytab.c @@ -299,17 +299,29 @@ int ads_keytab_add_entry(ADS_STRUCT *ads, const char *srvPrinc) if (strchr_m(srvPrinc, '@')) { /* It's a fully-named principal. */ - asprintf(&princ_s, "%s", srvPrinc); + if (asprintf(&princ_s, "%s", srvPrinc) == -1) { + ret = -1; + goto out; + } } else if (srvPrinc[strlen(srvPrinc)-1] == '$') { /* It's the machine account, as used by smbclient clients. */ - asprintf(&princ_s, "%s@%s", srvPrinc, lp_realm()); + if (asprintf(&princ_s, "%s@%s", srvPrinc, lp_realm()) == -1) { + ret = -1; + goto out; + } } else { /* It's a normal service principal. Add the SPN now so that we * can obtain credentials for it and double-check the salt value * used to generate the service's keys. */ - asprintf(&princ_s, "%s/%s@%s", srvPrinc, my_fqdn, lp_realm()); - asprintf(&short_princ_s, "%s/%s@%s", srvPrinc, machine_name, lp_realm()); + if (asprintf(&princ_s, "%s/%s@%s", srvPrinc, my_fqdn, lp_realm()) == -1) { + ret = -1; + goto out; + } + if (asprintf(&short_princ_s, "%s/%s@%s", srvPrinc, machine_name, lp_realm()) == -1) { + ret = -1; + goto out; + } /* According to http://support.microsoft.com/kb/326985/en-us, certain principal names are automatically mapped to the host/... |