diff options
author | Andreas Schneider <asn@samba.org> | 2019-03-12 09:40:58 +0100 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2019-03-26 07:49:17 +0000 |
commit | f0f56e7e84f44a6336dd9aef2d57bfbdb9c89347 (patch) | |
tree | 0c0bf337c34521eefeb654bc3d73eef1a661c019 /source3/client | |
parent | cc43f3cd3aa4ba7a85a8deaaf04058bc57e3c588 (diff) | |
download | samba-f0f56e7e84f44a6336dd9aef2d57bfbdb9c89347.tar.gz |
s3:client: Pass DEVICE_URI and AUTH_INFO_REQUIRED env to smbspool
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13832
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Bryan Mason <bmason@redhat.com>
Signed-off-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit 43160184d254a57f87bb2adeba47f48d8539533a)
Diffstat (limited to 'source3/client')
-rw-r--r-- | source3/client/smbspool_krb5_wrapper.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/source3/client/smbspool_krb5_wrapper.c b/source3/client/smbspool_krb5_wrapper.c index dee3b4c54be..5c4da33238b 100644 --- a/source3/client/smbspool_krb5_wrapper.c +++ b/source3/client/smbspool_krb5_wrapper.c @@ -84,24 +84,36 @@ int main(int argc, char *argv[]) struct passwd *pwd; char gen_cc[PATH_MAX] = {0}; struct stat sb; - char *env; + char *env = NULL; + char auth_info_required[256] = {0}; + char device_uri[4096] = {0}; uid_t uid = (uid_t)-1; gid_t gid = (gid_t)-1; unsigned long tmp; int cmp; int rc; + env = getenv("DEVICE_URI"); + if (env != NULL && strlen(env) > 2) { + snprintf(device_uri, sizeof(device_uri), "%s", env); + } + /* Check if AuthInfoRequired is set to negotiate */ env = getenv("AUTH_INFO_REQUIRED"); /* If not set, then just call smbspool. */ - if (env == NULL) { + if (env == NULL || env[0] == 0) { CUPS_SMB_DEBUG("AUTH_INFO_REQUIRED is not set - " "execute smbspool"); goto smbspool; } else { CUPS_SMB_DEBUG("AUTH_INFO_REQUIRED=%s", env); + snprintf(auth_info_required, + sizeof(auth_info_required), + "%s", + env); + cmp = strcmp(env, "username,password"); if (cmp == 0) { CUPS_SMB_DEBUG("Authenticate using username/password - " @@ -223,12 +235,18 @@ create_env: #else { extern char **environ; - environ = calloc(1, sizeof(*environ)); + environ = calloc(3, sizeof(*environ)); } #endif CUPS_SMB_DEBUG("Setting KRB5CCNAME to '%s'", gen_cc); setenv("KRB5CCNAME", gen_cc, 1); + if (device_uri[0] != '\0') { + setenv("DEVICE_URI", device_uri, 1); + } + if (auth_info_required[0] != '\0') { + setenv("AUTH_INFO_REQUIRED", auth_info_required, 1); + } smbspool: snprintf(smbspool_cmd, |