diff options
author | Andreas Schneider <asn@samba.org> | 2019-03-12 09:40:58 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2019-03-18 15:30:13 +0000 |
commit | 43160184d254a57f87bb2adeba47f48d8539533a (patch) | |
tree | 77790599abbc69ba6cdcb965ea96fba50c9aee52 /source3/client | |
parent | fad5e4eaeb9202c1b63c42ea09254c17c473e33a (diff) | |
download | samba-43160184d254a57f87bb2adeba47f48d8539533a.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>
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, |