2 Unix SMB/CIFS implementation.
4 Winbind status program.
6 Copyright (C) Tim Potter 2000-2003
7 Copyright (C) Andrew Bartlett <abartlet@samba.org> 2003-2004
8 Copyright (C) Francesco Chemolli <kinkie@kame.usr.dsi.unimi.it> 2000
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 #include "dynconfig.h"
27 #include "system/filesys.h"
28 #include "system/passwd.h"
29 #include "lib/cmdline/popt_common.h"
30 #include "auth/auth.h"
31 #include "librpc/gen_ndr/ndr_security.h"
33 #define SQUID_BUFFER_SIZE 2010
35 enum stdio_helper_mode {
46 #define NTLM_AUTH_FLAG_USER_SESSION_KEY 0x0004
47 #define NTLM_AUTH_FLAG_LMKEY 0x0008
50 typedef void (*stdio_helper_function)(enum stdio_helper_mode stdio_helper_mode,
51 char *buf, int length, void **private,
52 unsigned int mux_id, void **private2);
54 static void manage_squid_basic_request (enum stdio_helper_mode stdio_helper_mode,
55 char *buf, int length, void **private,
56 unsigned int mux_id, void **private2);
58 static void manage_gensec_request (enum stdio_helper_mode stdio_helper_mode,
59 char *buf, int length, void **private,
60 unsigned int mux_id, void **private2);
62 static void manage_ntlm_server_1_request (enum stdio_helper_mode stdio_helper_mode,
63 char *buf, int length, void **private,
64 unsigned int mux_id, void **private2);
66 static void manage_squid_request(enum stdio_helper_mode helper_mode,
67 stdio_helper_function fn, void **private2);
70 enum stdio_helper_mode mode;
72 stdio_helper_function fn;
73 } stdio_helper_protocols[] = {
74 { SQUID_2_4_BASIC, "squid-2.4-basic", manage_squid_basic_request},
75 { SQUID_2_5_BASIC, "squid-2.5-basic", manage_squid_basic_request},
76 { SQUID_2_5_NTLMSSP, "squid-2.5-ntlmssp", manage_gensec_request},
77 { GSS_SPNEGO_CLIENT, "gss-spnego-client", manage_gensec_request},
78 { GSS_SPNEGO_SERVER, "gss-spnego", manage_gensec_request},
79 { NTLMSSP_CLIENT_1, "ntlmssp-client-1", manage_gensec_request},
80 { NTLM_SERVER_1, "ntlm-server-1", manage_ntlm_server_1_request},
81 { NUM_HELPER_MODES, NULL, NULL}
84 extern int winbindd_fd;
86 static const char *opt_username;
87 static const char *opt_domain;
88 static const char *opt_workstation;
89 static const char *opt_password;
90 static int opt_multiplex;
93 static void mux_printf(unsigned int mux_id, const char *format, ...) PRINTF_ATTRIBUTE(2, 3);
95 static void mux_printf(unsigned int mux_id, const char *format, ...)
100 x_fprintf(x_stdout, "%d ", mux_id);
103 va_start(ap, format);
104 x_vfprintf(x_stdout, format, ap);
110 /* Copy of parse_domain_user from winbindd_util.c. Parse a string of the
111 form DOMAIN/user into a domain and a user */
113 static BOOL parse_ntlm_auth_domain_user(const char *domuser, fstring domain,
117 char *p = strchr(domuser,*lp_winbind_separator());
124 fstrcpy(domain, domuser);
125 domain[PTR_DIFF(p, domuser)] = 0;
130 /* Authenticate a user with a plaintext password */
132 static BOOL check_plaintext_auth(const char *user, const char *pass,
133 BOOL stdout_diagnostics)
135 return (strcmp(pass, opt_password) == 0);
138 /* authenticate a user with an encrypted username/password */
140 static NTSTATUS local_pw_check_specified(const char *username,
142 const char *workstation,
143 const DATA_BLOB *challenge,
144 const DATA_BLOB *lm_response,
145 const DATA_BLOB *nt_response,
147 DATA_BLOB *lm_session_key,
148 DATA_BLOB *user_session_key,
153 struct samr_Password lm_pw, nt_pw;
154 struct samr_Password *lm_pwd, *nt_pwd;
155 TALLOC_CTX *mem_ctx = talloc_init("local_pw_check_specified");
157 nt_status = NT_STATUS_NO_MEMORY;
160 E_md4hash(opt_password, nt_pw.hash);
161 if (E_deshash(opt_password, lm_pw.hash)) {
169 nt_status = ntlm_password_check(mem_ctx,
176 lm_pwd, nt_pwd, user_session_key, lm_session_key);
178 if (NT_STATUS_IS_OK(nt_status)) {
182 *lp_winbind_separator(),
186 DEBUG(3, ("Login for user [%s]\\[%s]@[%s] failed due to [%s]\n",
187 domain, username, workstation,
188 nt_errstr(nt_status)));
190 talloc_free(mem_ctx);
193 *error_string = strdup(nt_errstr(nt_status));
200 static void manage_squid_basic_request(enum stdio_helper_mode stdio_helper_mode,
201 char *buf, int length, void **private,
202 unsigned int mux_id, void **private2)
207 pass=memchr(buf,' ',length);
209 DEBUG(2, ("Password not found. Denying access\n"));
210 mux_printf(mux_id, "ERR\n");
216 if (stdio_helper_mode == SQUID_2_5_BASIC) {
217 rfc1738_unescape(user);
218 rfc1738_unescape(pass);
221 if (check_plaintext_auth(user, pass, False)) {
222 mux_printf(mux_id, "OK\n");
224 mux_printf(mux_id, "ERR\n");
228 /* This is a bit hairy, but the basic idea is to do a password callback
229 to the calling application. The callback comes from within gensec */
231 static void manage_gensec_get_pw_request(enum stdio_helper_mode stdio_helper_mode,
232 char *buf, int length, void **private,
233 unsigned int mux_id, void **password)
236 if (strlen(buf) < 2) {
237 DEBUG(1, ("query [%s] invalid", buf));
238 mux_printf(mux_id, "BH\n");
242 if (strlen(buf) > 3) {
243 in = base64_decode_data_blob(NULL, buf + 3);
245 in = data_blob(NULL, 0);
248 if (strncmp(buf, "PW ", 3) == 0) {
250 *password = talloc_strndup(*private /* hopefully the right gensec context, useful to use for talloc */,
251 (const char *)in.data, in.length);
253 if (*password == NULL) {
254 DEBUG(1, ("Out of memory\n"));
255 mux_printf(mux_id, "BH\n");
260 mux_printf(mux_id, "OK\n");
264 DEBUG(1, ("Asked for (and expected) a password\n"));
265 mux_printf(mux_id, "BH\n");
270 * Callback for password credentails. This is not async, and when
271 * GENSEC and the credentails code is made async, it will look rather
275 static const char *get_password(struct cli_credentials *credentials)
277 char *password = NULL;
279 /* Ask for a password */
280 mux_printf((unsigned int)credentials->priv_data, "PW\n");
281 credentials->priv_data = NULL;
283 manage_squid_request(NUM_HELPER_MODES /* bogus */, manage_gensec_get_pw_request, (void **)&password);
287 static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode,
288 char *buf, int length, void **private,
289 unsigned int mux_id, void **private2)
292 DATA_BLOB out = data_blob(NULL, 0);
293 char *out_base64 = NULL;
294 const char *reply_arg = NULL;
295 struct gensec_security **gensec_state = (struct gensec_security **)private;
298 const char *reply_code;
299 struct cli_credentials *creds;
303 if (strlen(buf) < 2) {
304 DEBUG(1, ("query [%s] invalid", buf));
305 mux_printf(mux_id, "BH\n");
309 if (strlen(buf) > 3) {
310 in = base64_decode_data_blob(NULL, buf + 3);
312 in = data_blob(NULL, 0);
315 if (strncmp(buf, "YR", 2) == 0) {
316 if (gensec_state && *gensec_state) {
317 talloc_free(*gensec_state);
318 *gensec_state = NULL;
320 } else if ( (strncmp(buf, "OK", 2) == 0)) {
324 } else if ( (strncmp(buf, "TT ", 3) != 0) &&
325 (strncmp(buf, "KK ", 3) != 0) &&
326 (strncmp(buf, "AF ", 3) != 0) &&
327 (strncmp(buf, "NA ", 3) != 0) &&
328 (strncmp(buf, "UG", 2) != 0) &&
329 (strncmp(buf, "PW ", 3) != 0)) {
330 DEBUG(1, ("SPNEGO request [%s] invalid\n", buf));
331 mux_printf(mux_id, "BH\n");
337 if (!(gensec_state && *gensec_state)) {
338 switch (stdio_helper_mode) {
339 case GSS_SPNEGO_CLIENT:
340 case NTLMSSP_CLIENT_1:
341 /* setup the client side */
343 nt_status = gensec_client_start(NULL, gensec_state, NULL);
344 if (!NT_STATUS_IS_OK(nt_status)) {
348 creds = cli_credentials_init(*gensec_state);
349 cli_credentials_set_conf(creds);
351 cli_credentials_set_username(creds, opt_username, CRED_SPECIFIED);
354 cli_credentials_set_domain(creds, opt_domain, CRED_SPECIFIED);
357 cli_credentials_set_password(creds, opt_password, CRED_SPECIFIED);
359 creds->password_obtained = CRED_CALLBACK;
360 creds->password_cb = get_password;
361 creds->priv_data = (void*)mux_id;
364 gensec_set_credentials(*gensec_state, creds);
367 case GSS_SPNEGO_SERVER:
368 case SQUID_2_5_NTLMSSP:
369 if (!NT_STATUS_IS_OK(gensec_server_start(NULL, gensec_state, NULL))) {
377 switch (stdio_helper_mode) {
378 case GSS_SPNEGO_CLIENT:
379 case GSS_SPNEGO_SERVER:
380 nt_status = gensec_start_mech_by_oid(*gensec_state, GENSEC_OID_SPNEGO);
385 case NTLMSSP_CLIENT_1:
389 case SQUID_2_5_NTLMSSP:
390 nt_status = gensec_start_mech_by_oid(*gensec_state, GENSEC_OID_NTLMSSP);
396 if (!NT_STATUS_IS_OK(nt_status)) {
397 DEBUG(1, ("GENSEC mech failed to start: %s\n", nt_errstr(nt_status)));
398 mux_printf(mux_id, "BH\n");
403 if (strncmp(buf, "PW ", 3) == 0) {
405 cli_credentials_set_password((*gensec_state)->credentials,
406 talloc_strndup((*gensec_state),
407 (const char *)in.data,
410 mux_printf(mux_id, "OK\n");
416 mem_ctx = talloc_named(NULL, 0, "manage_gensec_request internal mem_ctx");
418 if (strncmp(buf, "UG", 2) == 0) {
420 char *grouplist = NULL;
421 struct auth_session_info *session_info;
423 if (!NT_STATUS_IS_OK(gensec_session_info(*gensec_state, &session_info))) {
424 DEBUG(1, ("gensec_session_info failed: %s\n", nt_errstr(nt_status)));
425 mux_printf(mux_id, "BH %s\n", nt_errstr(nt_status));
430 /* get the string onto the context */
431 grouplist = talloc_strdup(mem_ctx, "");
433 for (i=0; i<session_info->security_token->num_sids; i++) {
434 struct security_token *token = session_info->security_token;
435 const char *sidstr = dom_sid_string(session_info,
437 grouplist = talloc_asprintf_append(grouplist, "%s,", sidstr);
440 mux_printf(mux_id, "GL %s\n", grouplist);
441 talloc_free(session_info);
443 talloc_free(mem_ctx);
447 nt_status = gensec_update(*gensec_state, mem_ctx, in, &out);
449 /* don't leak 'bad password'/'no such user' info to the network client */
450 nt_status = auth_nt_status_squash(nt_status);
453 out_base64 = base64_encode_data_blob(mem_ctx, out);
458 if (NT_STATUS_EQUAL(nt_status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
462 } else if ((*gensec_state)->gensec_role == GENSEC_CLIENT) {
464 } else if ((*gensec_state)->gensec_role == GENSEC_SERVER) {
471 } else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_ACCESS_DENIED)) {
473 reply_arg = nt_errstr(nt_status);
474 DEBUG(1, ("GENSEC login failed: %s\n", nt_errstr(nt_status)));
475 } else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_UNSUCCESSFUL)) {
477 reply_arg = nt_errstr(nt_status);
478 DEBUG(1, ("GENSEC login failed: %s\n", nt_errstr(nt_status)));
479 } else if (!NT_STATUS_IS_OK(nt_status)) {
481 reply_arg = nt_errstr(nt_status);
482 DEBUG(1, ("GENSEC login failed: %s\n", nt_errstr(nt_status)));
483 } else if /* OK */ ((*gensec_state)->gensec_role == GENSEC_SERVER) {
484 struct auth_session_info *session_info;
486 nt_status = gensec_session_info(*gensec_state, &session_info);
487 if (!NT_STATUS_IS_OK(nt_status)) {
489 reply_arg = nt_errstr(nt_status);
490 DEBUG(1, ("GENSEC failed to retreive the session info: %s\n", nt_errstr(nt_status)));
494 reply_arg = talloc_asprintf(*gensec_state,
495 "%s%s%s", session_info->server_info->domain_name,
496 lp_winbind_separator(), session_info->server_info->account_name);
497 talloc_free(session_info);
499 } else if ((*gensec_state)->gensec_role == GENSEC_CLIENT) {
506 switch (stdio_helper_mode) {
507 case GSS_SPNEGO_SERVER:
508 mux_printf(mux_id, "%s %s %s\n", reply_code,
509 out_base64 ? out_base64 : "*",
510 reply_arg ? reply_arg : "*");
514 mux_printf(mux_id, "%s %s\n", reply_code, out_base64);
515 } else if (reply_arg) {
516 mux_printf(mux_id, "%s %s\n", reply_code, reply_arg);
518 mux_printf(mux_id, "%s\n", reply_code);
522 talloc_free(mem_ctx);
526 static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mode,
527 char *buf, int length, void **private,
528 unsigned int mux_id, void **private2)
530 char *request, *parameter;
531 static DATA_BLOB challenge;
532 static DATA_BLOB lm_response;
533 static DATA_BLOB nt_response;
534 static char *full_username;
535 static char *username;
537 static char *plaintext_password;
538 static BOOL ntlm_server_1_user_session_key;
539 static BOOL ntlm_server_1_lm_session_key;
541 if (strequal(buf, ".")) {
542 if (!full_username && !username) {
543 mux_printf(mux_id, "Error: No username supplied!\n");
544 } else if (plaintext_password) {
545 /* handle this request as plaintext */
546 if (!full_username) {
547 if (asprintf(&full_username, "%s%c%s", domain, *lp_winbind_separator(), username) == -1) {
548 mux_printf(mux_id, "Error: Out of memory in asprintf!\n.\n");
552 if (check_plaintext_auth(full_username, plaintext_password, False)) {
553 mux_printf(mux_id, "Authenticated: Yes\n");
555 mux_printf(mux_id, "Authenticated: No\n");
557 } else if (!lm_response.data && !nt_response.data) {
558 mux_printf(mux_id, "Error: No password supplied!\n");
559 } else if (!challenge.data) {
560 mux_printf(mux_id, "Error: No lanman-challenge supplied!\n");
562 char *error_string = NULL;
564 DATA_BLOB user_session_key;
567 if (full_username && !username) {
571 if (!parse_ntlm_auth_domain_user(full_username, fstr_user, fstr_domain)) {
572 /* username might be 'tainted', don't print into our new-line deleimianted stream */
573 mux_printf(mux_id, "Error: Could not parse into domain and username\n");
577 username = smb_xstrdup(fstr_user);
578 domain = smb_xstrdup(fstr_domain);
582 domain = smb_xstrdup(lp_workgroup());
585 if (ntlm_server_1_lm_session_key)
586 flags |= NTLM_AUTH_FLAG_LMKEY;
588 if (ntlm_server_1_user_session_key)
589 flags |= NTLM_AUTH_FLAG_USER_SESSION_KEY;
591 if (!NT_STATUS_IS_OK(
592 local_pw_check_specified(username,
604 mux_printf(mux_id, "Authenticated: No\n");
605 mux_printf(mux_id, "Authentication-Error: %s\n.\n", error_string);
606 SAFE_FREE(error_string);
608 static char zeros[16];
610 char *hex_user_session_key;
612 mux_printf(mux_id, "Authenticated: Yes\n");
614 if (ntlm_server_1_lm_session_key
616 && (memcmp(zeros, lm_key.data,
617 lm_key.length) != 0)) {
618 hex_encode(lm_key.data,
621 mux_printf(mux_id, "LANMAN-Session-Key: %s\n", hex_lm_key);
622 SAFE_FREE(hex_lm_key);
625 if (ntlm_server_1_user_session_key
626 && user_session_key.length
627 && (memcmp(zeros, user_session_key.data,
628 user_session_key.length) != 0)) {
629 hex_encode(user_session_key.data,
630 user_session_key.length,
631 &hex_user_session_key);
632 mux_printf(mux_id, "User-Session-Key: %s\n", hex_user_session_key);
633 SAFE_FREE(hex_user_session_key);
637 /* clear out the state */
638 challenge = data_blob(NULL, 0);
639 nt_response = data_blob(NULL, 0);
640 lm_response = data_blob(NULL, 0);
641 SAFE_FREE(full_username);
644 SAFE_FREE(plaintext_password);
645 ntlm_server_1_user_session_key = False;
646 ntlm_server_1_lm_session_key = False;
647 mux_printf(mux_id, ".\n");
654 /* Indicates a base64 encoded structure */
655 parameter = strstr(request, ":: ");
657 parameter = strstr(request, ": ");
660 DEBUG(0, ("Parameter not found!\n"));
661 mux_printf(mux_id, "Error: Parameter not found!\n.\n");
678 base64_decode_inplace(parameter);
681 if (strequal(request, "LANMAN-Challenge")) {
682 challenge = strhex_to_data_blob(parameter);
683 if (challenge.length != 8) {
684 mux_printf(mux_id, "Error: hex decode of %s failed! (got %d bytes, expected 8)\n.\n",
686 (int)challenge.length);
687 challenge = data_blob(NULL, 0);
689 } else if (strequal(request, "NT-Response")) {
690 nt_response = strhex_to_data_blob(parameter);
691 if (nt_response.length < 24) {
692 mux_printf(mux_id, "Error: hex decode of %s failed! (only got %d bytes, needed at least 24)\n.\n",
694 (int)nt_response.length);
695 nt_response = data_blob(NULL, 0);
697 } else if (strequal(request, "LANMAN-Response")) {
698 lm_response = strhex_to_data_blob(parameter);
699 if (lm_response.length != 24) {
700 mux_printf(mux_id, "Error: hex decode of %s failed! (got %d bytes, expected 24)\n.\n",
702 (int)lm_response.length);
703 lm_response = data_blob(NULL, 0);
705 } else if (strequal(request, "Password")) {
706 plaintext_password = smb_xstrdup(parameter);
707 } else if (strequal(request, "NT-Domain")) {
708 domain = smb_xstrdup(parameter);
709 } else if (strequal(request, "Username")) {
710 username = smb_xstrdup(parameter);
711 } else if (strequal(request, "Full-Username")) {
712 full_username = smb_xstrdup(parameter);
713 } else if (strequal(request, "Request-User-Session-Key")) {
714 ntlm_server_1_user_session_key = strequal(parameter, "Yes");
715 } else if (strequal(request, "Request-LanMan-Session-Key")) {
716 ntlm_server_1_lm_session_key = strequal(parameter, "Yes");
718 mux_printf(mux_id, "Error: Unknown request %s\n.\n", request);
722 static void manage_squid_request(enum stdio_helper_mode helper_mode,
723 stdio_helper_function fn, void **private2)
725 char buf[SQUID_BUFFER_SIZE+1];
731 unsigned int max_mux;
732 void **private_pointers;
735 static struct mux_private *mux_private;
736 static void *normal_private;
739 /* this is not a typo - x_fgets doesn't work too well under squid */
740 if (fgets(buf, sizeof(buf)-1, stdin) == NULL) {
742 DEBUG(1, ("fgets() failed! dying..... errno=%d (%s)\n", ferror(stdin),
743 strerror(ferror(stdin))));
745 exit(1); /* BIIG buffer */
750 c=memchr(buf,'\n',sizeof(buf)-1);
759 DEBUG(0, ("Oversized message\n"));
760 x_fprintf(x_stdout, "ERR\n");
765 DEBUG(10, ("Got '%s' from squid (length: %d).\n",buf,length));
767 if (buf[0] == '\0') {
768 DEBUG(0, ("Invalid Request (empty)\n"));
769 x_fprintf(x_stdout, "ERR\n");
774 if (sscanf(buf, "%u ", &mux_id) != 1) {
775 DEBUG(0, ("Invalid Request - no multiplex id\n"));
776 x_fprintf(x_stdout, "ERR\n");
780 mux_private = talloc(NULL, struct mux_private);
781 mux_private->max_mux = 0;
782 mux_private->private_pointers = NULL;
787 DEBUG(0, ("Invalid Request - no data after multiplex id\n"));
788 x_fprintf(x_stdout, "ERR\n");
792 if (mux_id >= mux_private->max_mux) {
793 unsigned int prev_max = mux_private->max_mux;
794 mux_private->max_mux = mux_id + 1;
795 mux_private->private_pointers
796 = talloc_realloc(mux_private,
797 mux_private->private_pointers,
798 void *, mux_private->max_mux);
799 memset(&mux_private->private_pointers[prev_max], '\0',
800 (sizeof(*mux_private->private_pointers) * (mux_private->max_mux - prev_max)));
803 private = &mux_private->private_pointers[mux_id];
806 private = &normal_private;
809 fn(helper_mode, c, length, private, mux_id, private2);
812 static void squid_stream(enum stdio_helper_mode stdio_mode,
813 stdio_helper_function fn) {
814 /* initialize FDescs */
815 x_setbuf(x_stdout, NULL);
816 x_setbuf(x_stderr, NULL);
818 manage_squid_request(stdio_mode, fn, NULL);
835 OPT_USER_SESSION_KEY,
837 OPT_REQUIRE_MEMBERSHIP,
841 int main(int argc, const char **argv)
843 static const char *helper_protocol;
848 /* NOTE: DO NOT change this interface without considering the implications!
849 This is an external interface, which other programs will use to interact
853 /* We do not use single-letter command abbreviations, because they harm future
854 interface stability. */
856 struct poptOption long_options[] = {
858 { "helper-protocol", 0, POPT_ARG_STRING, &helper_protocol, OPT_DOMAIN, "operate as a stdio-based helper", "helper protocol to use"},
859 { "domain", 0, POPT_ARG_STRING, &opt_domain, OPT_DOMAIN, "domain name"},
860 { "workstation", 0, POPT_ARG_STRING, &opt_workstation, OPT_WORKSTATION, "workstation"},
861 { "username", 0, POPT_ARG_STRING, &opt_username, OPT_PASSWORD, "Username"},
862 { "password", 0, POPT_ARG_STRING, &opt_password, OPT_PASSWORD, "User's plaintext password"},
863 { "multiplex", 0, POPT_ARG_NONE, &opt_multiplex, OPT_MULTIPLEX, "Multiplex Mode"},
868 /* Samba client initialisation */
870 setup_logging(NULL, DEBUG_STDERR);
874 pc = poptGetContext("ntlm_auth", argc, argv, long_options, 0);
876 /* Parse command line options */
879 poptPrintHelp(pc, stderr, 0);
883 pc = poptGetContext(NULL, argc, (const char **)argv, long_options,
884 POPT_CONTEXT_KEEP_FIRST);
886 while((opt = poptGetNextOpt(pc)) != -1) {
892 fprintf(stderr, "%s: %s\n",
893 poptBadOption(pc, POPT_BADOPTION_NOALIAS),
898 ntlm_auth_init_subsystems;
901 if (opt_domain == NULL) {
902 opt_domain = lp_workgroup();
905 if (helper_protocol) {
907 for (i=0; i<NUM_HELPER_MODES; i++) {
908 if (strcmp(helper_protocol, stdio_helper_protocols[i].name) == 0) {
909 squid_stream(stdio_helper_protocols[i].mode, stdio_helper_protocols[i].fn);
913 x_fprintf(x_stderr, "unknown helper protocol [%s]\n\nValid helper protools:\n\n", helper_protocol);
915 for (i=0; i<NUM_HELPER_MODES; i++) {
916 x_fprintf(x_stderr, "%s\n", stdio_helper_protocols[i].name);
923 x_fprintf(x_stderr, "username must be specified!\n\n");
924 poptPrintHelp(pc, stderr, 0);
928 if (opt_workstation == NULL) {
929 opt_workstation = lp_netbios_name();
933 opt_password = getpass("password: ");
939 asprintf(&user, "%s%c%s", opt_domain, *lp_winbind_separator(), opt_username);
940 if (!check_plaintext_auth(user, opt_password, True)) {