diff options
author | Volker Lendecke <vlendec@samba.org> | 2004-04-01 12:31:50 +0000 |
---|---|---|
committer | Volker Lendecke <vlendec@samba.org> | 2004-04-01 12:31:50 +0000 |
commit | 56e7c149babcf41e5c510104a8e0cdca56f227f0 (patch) | |
tree | 17e87dc5db42586bd072db1b47bc2ae11dcf1c30 /source3/nsswitch/winbindd_pam.c | |
parent | e2f355c7eae4f1fda705cc223575193535b91da5 (diff) | |
download | samba-56e7c149babcf41e5c510104a8e0cdca56f227f0.tar.gz samba-56e7c149babcf41e5c510104a8e0cdca56f227f0.tar.xz samba-56e7c149babcf41e5c510104a8e0cdca56f227f0.zip |
This restructures lib/afs.c so that the token data can be but into a
stream. This is to implement wbinfo -k that asks winbind for authentication
which then creates the AFS token for the authenticated user.
Volker
(This used to be commit 2df6750a079820826013360fb9e47f90bc8223a5)
Diffstat (limited to 'source3/nsswitch/winbindd_pam.c')
-rw-r--r-- | source3/nsswitch/winbindd_pam.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/source3/nsswitch/winbindd_pam.c b/source3/nsswitch/winbindd_pam.c index 37b2a9f21b..1d232edfe3 100644 --- a/source3/nsswitch/winbindd_pam.c +++ b/source3/nsswitch/winbindd_pam.c @@ -211,6 +211,41 @@ done: state->response.data.auth.nt_status_string, state->response.data.auth.pam_error)); + if ( NT_STATUS_IS_OK(result) && + (state->request.flags & WBFLAG_PAM_AFS_TOKEN) ) { + + char *afsname = strdup(lp_afs_username_map()); + char *cell; + + if (afsname == NULL) goto no_token; + + afsname = realloc_string_sub(afsname, "%D", name_domain); + afsname = realloc_string_sub(afsname, "%u", name_user); + afsname = realloc_string_sub(afsname, "%U", name_user); + + if (afsname == NULL) goto no_token; + + strlower_m(afsname); + + cell = strchr(afsname, '@'); + + if (cell == NULL) goto no_token; + + *cell = '\0'; + cell += 1; + + /* Append an AFS token string */ + state->response.extra_data = + afs_createtoken_str(afsname, cell); + + if (state->response.extra_data != NULL) + state->response.length += + strlen(state->response.extra_data)+1; + + no_token: + SAFE_FREE(afsname); + } + if (mem_ctx) talloc_destroy(mem_ctx); |