summaryrefslogtreecommitdiff
path: root/source3/libads/kerberos.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2002-09-27 12:23:47 +0000
committerAndrew Bartlett <abartlet@samba.org>2002-09-27 12:23:47 +0000
commit7e4afe538147bf31689f47232d5f2b04830dda1d (patch)
tree728ba39aa0cd91f0e4e2251f261d8f1d93d5b32e /source3/libads/kerberos.c
parentdc262e3f39ec41576a586332b01e183b5583d3a6 (diff)
downloadsamba-7e4afe538147bf31689f47232d5f2b04830dda1d.tar.gz
samba-7e4afe538147bf31689f47232d5f2b04830dda1d.tar.bz2
samba-7e4afe538147bf31689f47232d5f2b04830dda1d.zip
Move a number of ADS related functions out into utility libs, so that things
like metze's sam_ads can also use them. Also add error checking etc to a few more functions. Andrew Bartlett (This used to be commit c864edf4fbf8a6c37888a14b861d7c12cf503d4f)
Diffstat (limited to 'source3/libads/kerberos.c')
-rw-r--r--source3/libads/kerberos.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c
index a80837cf4d..b586d84226 100644
--- a/source3/libads/kerberos.c
+++ b/source3/libads/kerberos.c
@@ -114,7 +114,14 @@ int ads_kinit_password(ADS_STRUCT *ads)
char *s;
int ret;
- asprintf(&s, "%s@%s", ads->auth.user_name, ads->auth.realm);
+ if (asprintf(&s, "%s@%s", ads->auth.user_name, ads->auth.realm) == -1) {
+ return KRB5_CC_NOMEM;
+ }
+
+ if (!ads->auth.password) {
+ return KRB5_LIBOS_CANTREADPWD;
+ }
+
ret = kerberos_kinit_password(s, ads->auth.password, ads->auth.time_offset);
if (ret) {