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 "libcli/security/security.h"
34 #define DBGC_CLASS DBGC_WINBIND
36 #define SQUID_BUFFER_SIZE 2010
38 enum stdio_helper_mode {
49 #define NTLM_AUTH_FLAG_USER_SESSION_KEY 0x0004
50 #define NTLM_AUTH_FLAG_LMKEY 0x0008
53 typedef void (*stdio_helper_function)(enum stdio_helper_mode stdio_helper_mode,
54 char *buf, int length, void **private,
57 static void manage_squid_basic_request (enum stdio_helper_mode stdio_helper_mode,
58 char *buf, int length, void **private,
61 static void manage_gensec_request (enum stdio_helper_mode stdio_helper_mode,
62 char *buf, int length, void **private,
65 static void manage_ntlm_server_1_request (enum stdio_helper_mode stdio_helper_mode,
66 char *buf, int length, void **private,
69 static void manage_squid_request(enum stdio_helper_mode helper_mode,
70 stdio_helper_function fn);
73 enum stdio_helper_mode mode;
75 stdio_helper_function fn;
76 } stdio_helper_protocols[] = {
77 { SQUID_2_4_BASIC, "squid-2.4-basic", manage_squid_basic_request},
78 { SQUID_2_5_BASIC, "squid-2.5-basic", manage_squid_basic_request},
79 { SQUID_2_5_NTLMSSP, "squid-2.5-ntlmssp", manage_gensec_request},
80 { GSS_SPNEGO_CLIENT, "gss-spnego-client", manage_gensec_request},
81 { GSS_SPNEGO_SERVER, "gss-spnego", manage_gensec_request},
82 { NTLMSSP_CLIENT_1, "ntlmssp-client-1", manage_gensec_request},
83 { NTLM_SERVER_1, "ntlm-server-1", manage_ntlm_server_1_request},
84 { NUM_HELPER_MODES, NULL, NULL}
87 extern int winbindd_fd;
89 const char *opt_username;
90 const char *opt_domain;
91 const char *opt_workstation;
92 const char *opt_password;
96 static void mux_printf(unsigned int mux_id, const char *format, ...) PRINTF_ATTRIBUTE(2, 3);
98 static void mux_printf(unsigned int mux_id, const char *format, ...)
103 x_fprintf(x_stdout, "%d ", mux_id);
106 va_start(ap, format);
107 x_vfprintf(x_stdout, format, ap);
113 /* Copy of parse_domain_user from winbindd_util.c. Parse a string of the
114 form DOMAIN/user into a domain and a user */
116 static BOOL parse_ntlm_auth_domain_user(const char *domuser, fstring domain,
120 char *p = strchr(domuser,*lp_winbind_separator());
127 fstrcpy(domain, domuser);
128 domain[PTR_DIFF(p, domuser)] = 0;
133 /* Authenticate a user with a plaintext password */
135 static BOOL check_plaintext_auth(const char *user, const char *pass,
136 BOOL stdout_diagnostics)
138 return (strcmp(pass, opt_password) == 0);
141 /* authenticate a user with an encrypted username/password */
143 static NTSTATUS local_pw_check_specified(const char *username,
145 const char *workstation,
146 const DATA_BLOB *challenge,
147 const DATA_BLOB *lm_response,
148 const DATA_BLOB *nt_response,
150 DATA_BLOB *lm_session_key,
151 DATA_BLOB *user_session_key,
156 uint8_t lm_pw[16], nt_pw[16];
157 uint8_t *lm_pwd, *nt_pwd;
158 TALLOC_CTX *mem_ctx = talloc_init("local_pw_check_specified");
160 nt_status = NT_STATUS_NO_MEMORY;
163 E_md4hash(opt_password, nt_pw);
164 if (E_deshash(opt_password, lm_pw)) {
172 nt_status = ntlm_password_check(mem_ctx,
180 lm_pwd, nt_pwd, user_session_key, lm_session_key);
182 if (NT_STATUS_IS_OK(nt_status)) {
186 *lp_winbind_separator(),
190 DEBUG(3, ("Login for user [%s]\\[%s]@[%s] failed due to [%s]\n",
191 domain, username, workstation,
192 nt_errstr(nt_status)));
194 talloc_free(mem_ctx);
197 *error_string = strdup(nt_errstr(nt_status));
204 static void manage_squid_basic_request(enum stdio_helper_mode stdio_helper_mode,
205 char *buf, int length, void **private,
211 pass=memchr(buf,' ',length);
213 DEBUG(2, ("Password not found. Denying access\n"));
214 mux_printf(mux_id, "ERR\n");
220 if (stdio_helper_mode == SQUID_2_5_BASIC) {
221 rfc1738_unescape(user);
222 rfc1738_unescape(pass);
225 if (check_plaintext_auth(user, pass, False)) {
226 mux_printf(mux_id, "OK\n");
228 mux_printf(mux_id, "ERR\n");
232 /* This is a bit hairy, but the basic idea is to do a password callback
233 to the calling application. The callback comes from within gensec */
235 static void manage_gensec_get_pw_request(enum stdio_helper_mode stdio_helper_mode,
236 char *buf, int length, void **private,
240 struct gensec_security **gensec_state = (struct gensec_security **)private;
241 if (strlen(buf) < 2) {
242 DEBUG(1, ("query [%s] invalid", buf));
243 mux_printf(mux_id, "BH\n");
247 if (strlen(buf) > 3) {
248 in = base64_decode_data_blob(buf + 3);
250 in = data_blob(NULL, 0);
253 if (strncmp(buf, "PW ", 3) == 0) {
255 (*gensec_state)->password_callback_private = talloc_strndup((*gensec_state),
256 (const char *)in.data, in.length);
258 if ((*gensec_state)->password_callback_private == NULL) {
259 DEBUG(1, ("Out of memory\n"));
260 mux_printf(mux_id, "BH\n");
265 mux_printf(mux_id, "OK\n");
269 DEBUG(1, ("Asked for (and expected) a password\n"));
270 mux_printf(mux_id, "BH\n");
275 * Callback for gensec, to ask the calling application for a password. Uses the above function
276 * for the stdio part of this.
279 static NTSTATUS get_password(struct gensec_security *gensec_security,
285 /* Ask for a password */
286 mux_printf((unsigned int)gensec_security->password_callback_private, "PW\n");
287 gensec_security->password_callback_private = NULL;
289 manage_squid_request(NUM_HELPER_MODES /* bogus */, manage_gensec_get_pw_request);
290 *password = (char *)gensec_security->password_callback_private;
294 return NT_STATUS_INVALID_PARAMETER;
298 static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode,
299 char *buf, int length, void **private,
303 DATA_BLOB out = data_blob(NULL, 0);
304 char *out_base64 = NULL;
305 const char *reply_arg = NULL;
306 struct gensec_security **gensec_state = (struct gensec_security **)private;
309 const char *reply_code;
311 if (strlen(buf) < 2) {
312 DEBUG(1, ("query [%s] invalid", buf));
313 mux_printf(mux_id, "BH\n");
317 if (strlen(buf) > 3) {
318 in = base64_decode_data_blob(buf + 3);
320 in = data_blob(NULL, 0);
323 if (strncmp(buf, "YR", 2) == 0) {
324 if (gensec_state && *gensec_state) {
325 talloc_free(*gensec_state);
326 *gensec_state = NULL;
328 } else if ( (strncmp(buf, "OK", 2) == 0)) {
332 } else if ( (strncmp(buf, "TT ", 3) != 0) &&
333 (strncmp(buf, "KK ", 3) != 0) &&
334 (strncmp(buf, "AF ", 3) != 0) &&
335 (strncmp(buf, "NA ", 3) != 0) &&
336 (strncmp(buf, "UG", 2) != 0) &&
337 (strncmp(buf, "PW ", 3) != 0)) {
338 DEBUG(1, ("SPNEGO request [%s] invalid\n", buf));
339 mux_printf(mux_id, "BH\n");
345 if (!(gensec_state && *gensec_state)) {
346 switch (stdio_helper_mode) {
347 case GSS_SPNEGO_CLIENT:
348 case NTLMSSP_CLIENT_1:
349 /* setup the client side */
351 if (!NT_STATUS_IS_OK(gensec_client_start(NULL, gensec_state))) {
354 gensec_set_username(*gensec_state, opt_username);
355 gensec_set_domain(*gensec_state, opt_domain);
357 if (!NT_STATUS_IS_OK(gensec_set_password(*gensec_state, opt_password))) {
358 DEBUG(1, ("Out of memory\n"));
359 mux_printf(mux_id, "BH\n");
364 gensec_set_password_callback(*gensec_state, get_password, (void*)mux_id);
368 case GSS_SPNEGO_SERVER:
369 case SQUID_2_5_NTLMSSP:
370 if (!NT_STATUS_IS_OK(gensec_server_start(NULL, gensec_state))) {
378 switch (stdio_helper_mode) {
379 case GSS_SPNEGO_CLIENT:
380 case GSS_SPNEGO_SERVER:
381 nt_status = gensec_start_mech_by_oid(*gensec_state, GENSEC_OID_SPNEGO);
386 case NTLMSSP_CLIENT_1:
390 case SQUID_2_5_NTLMSSP:
391 nt_status = gensec_start_mech_by_oid(*gensec_state, GENSEC_OID_NTLMSSP);
397 if (!NT_STATUS_IS_OK(nt_status)) {
398 DEBUG(1, ("SPENGO login failed to initialise: %s\n", nt_errstr(nt_status)));
399 mux_printf(mux_id, "BH\n");
404 if (strncmp(buf, "PW ", 3) == 0) {
406 if (!NT_STATUS_IS_OK(gensec_set_password(*gensec_state,
407 talloc_strndup((*gensec_state),
408 (const char *)in.data,
410 DEBUG(1, ("gensec_set_password failed: %s\n", nt_errstr(nt_status)));
411 mux_printf(mux_id, "BH %s\n", nt_errstr(nt_status));
416 mux_printf(mux_id, "OK\n");
421 if (strncmp(buf, "UG", 2) == 0) {
423 char *grouplist = NULL;
424 struct auth_session_info *session_info;
426 if (!NT_STATUS_IS_OK(gensec_session_info(*gensec_state, &session_info))) {
427 DEBUG(1, ("gensec_session_info failed: %s\n", nt_errstr(nt_status)));
428 mux_printf(mux_id, "BH %s\n", nt_errstr(nt_status));
433 /* get the string onto the context */
434 grouplist = talloc_strdup(session_info, "");
436 for (i=0; i<session_info->security_token->num_sids; i++) {
437 struct security_token *token = session_info->security_token;
438 const char *sidstr = dom_sid_string(session_info,
440 grouplist = talloc_asprintf_append(grouplist, "%s,", sidstr);
443 mux_printf(mux_id, "GL %s\n", grouplist);
444 talloc_free(session_info);
451 nt_status = gensec_update(*gensec_state, NULL, in, &out);
453 /* don't leak 'bad password'/'no such user' info to the network client */
454 nt_status = auth_nt_status_squash(nt_status);
457 out_base64 = base64_encode_data_blob(out);
461 if (NT_STATUS_EQUAL(nt_status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
465 } else if ((*gensec_state)->gensec_role == GENSEC_CLIENT) {
467 } else if ((*gensec_state)->gensec_role == GENSEC_SERVER) {
474 } else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_ACCESS_DENIED)) {
476 reply_arg = nt_errstr(nt_status);
477 DEBUG(1, ("GENSEC login failed: %s\n", nt_errstr(nt_status)));
478 } else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_UNSUCCESSFUL)) {
480 reply_arg = nt_errstr(nt_status);
481 DEBUG(1, ("GENSEC login failed: %s\n", nt_errstr(nt_status)));
482 } else if (!NT_STATUS_IS_OK(nt_status)) {
484 reply_arg = nt_errstr(nt_status);
485 DEBUG(1, ("GENSEC login failed: %s\n", nt_errstr(nt_status)));
486 } else if /* OK */ ((*gensec_state)->gensec_role == GENSEC_SERVER) {
487 struct auth_session_info *session_info;
489 nt_status = gensec_session_info(*gensec_state, &session_info);
490 if (!NT_STATUS_IS_OK(nt_status)) {
492 reply_arg = nt_errstr(nt_status);
493 DEBUG(1, ("GENSEC failed to retreive the session info: %s\n", nt_errstr(nt_status)));
497 reply_arg = talloc_asprintf(*gensec_state,
498 "%s%s%s", session_info->server_info->domain_name,
499 lp_winbind_separator(), session_info->server_info->account_name);
500 talloc_free(session_info);
502 } else if ((*gensec_state)->gensec_role == GENSEC_CLIENT) {
509 switch (stdio_helper_mode) {
510 case GSS_SPNEGO_SERVER:
511 mux_printf(mux_id, "%s %s %s\n", reply_code,
512 out_base64 ? out_base64 : "*",
513 reply_arg ? reply_arg : "*");
517 mux_printf(mux_id, "%s %s\n", reply_code, out_base64);
518 } else if (reply_arg) {
519 mux_printf(mux_id, "%s %s\n", reply_code, reply_arg);
521 mux_printf(mux_id, "%s\n", reply_code);
525 SAFE_FREE(out_base64);
529 static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mode,
530 char *buf, int length, void **private,
533 char *request, *parameter;
534 static DATA_BLOB challenge;
535 static DATA_BLOB lm_response;
536 static DATA_BLOB nt_response;
537 static char *full_username;
538 static char *username;
540 static char *plaintext_password;
541 static BOOL ntlm_server_1_user_session_key;
542 static BOOL ntlm_server_1_lm_session_key;
544 if (strequal(buf, ".")) {
545 if (!full_username && !username) {
546 mux_printf(mux_id, "Error: No username supplied!\n");
547 } else if (plaintext_password) {
548 /* handle this request as plaintext */
549 if (!full_username) {
550 if (asprintf(&full_username, "%s%c%s", domain, *lp_winbind_separator(), username) == -1) {
551 mux_printf(mux_id, "Error: Out of memory in asprintf!\n.\n");
555 if (check_plaintext_auth(full_username, plaintext_password, False)) {
556 mux_printf(mux_id, "Authenticated: Yes\n");
558 mux_printf(mux_id, "Authenticated: No\n");
560 } else if (!lm_response.data && !nt_response.data) {
561 mux_printf(mux_id, "Error: No password supplied!\n");
562 } else if (!challenge.data) {
563 mux_printf(mux_id, "Error: No lanman-challenge supplied!\n");
565 char *error_string = NULL;
567 DATA_BLOB user_session_key;
570 if (full_username && !username) {
574 if (!parse_ntlm_auth_domain_user(full_username, fstr_user, fstr_domain)) {
575 /* username might be 'tainted', don't print into our new-line deleimianted stream */
576 mux_printf(mux_id, "Error: Could not parse into domain and username\n");
580 username = smb_xstrdup(fstr_user);
581 domain = smb_xstrdup(fstr_domain);
585 domain = smb_xstrdup(lp_workgroup());
588 if (ntlm_server_1_lm_session_key)
589 flags |= NTLM_AUTH_FLAG_LMKEY;
591 if (ntlm_server_1_user_session_key)
592 flags |= NTLM_AUTH_FLAG_USER_SESSION_KEY;
594 if (!NT_STATUS_IS_OK(
595 local_pw_check_specified(username,
607 mux_printf(mux_id, "Authenticated: No\n");
608 mux_printf(mux_id, "Authentication-Error: %s\n.\n", error_string);
609 SAFE_FREE(error_string);
611 static char zeros[16];
613 char *hex_user_session_key;
615 mux_printf(mux_id, "Authenticated: Yes\n");
617 if (ntlm_server_1_lm_session_key
619 && (memcmp(zeros, lm_key.data,
620 lm_key.length) != 0)) {
621 hex_encode(lm_key.data,
624 mux_printf(mux_id, "LANMAN-Session-Key: %s\n", hex_lm_key);
625 SAFE_FREE(hex_lm_key);
628 if (ntlm_server_1_user_session_key
629 && user_session_key.length
630 && (memcmp(zeros, user_session_key.data,
631 user_session_key.length) != 0)) {
632 hex_encode(user_session_key.data,
633 user_session_key.length,
634 &hex_user_session_key);
635 mux_printf(mux_id, "User-Session-Key: %s\n", hex_user_session_key);
636 SAFE_FREE(hex_user_session_key);
640 /* clear out the state */
641 challenge = data_blob(NULL, 0);
642 nt_response = data_blob(NULL, 0);
643 lm_response = data_blob(NULL, 0);
644 SAFE_FREE(full_username);
647 SAFE_FREE(plaintext_password);
648 ntlm_server_1_user_session_key = False;
649 ntlm_server_1_lm_session_key = False;
650 mux_printf(mux_id, ".\n");
657 /* Indicates a base64 encoded structure */
658 parameter = strstr(request, ":: ");
660 parameter = strstr(request, ": ");
663 DEBUG(0, ("Parameter not found!\n"));
664 mux_printf(mux_id, "Error: Parameter not found!\n.\n");
681 base64_decode_inplace(parameter);
684 if (strequal(request, "LANMAN-Challenge")) {
685 challenge = strhex_to_data_blob(parameter);
686 if (challenge.length != 8) {
687 mux_printf(mux_id, "Error: hex decode of %s failed! (got %d bytes, expected 8)\n.\n",
689 (int)challenge.length);
690 challenge = data_blob(NULL, 0);
692 } else if (strequal(request, "NT-Response")) {
693 nt_response = strhex_to_data_blob(parameter);
694 if (nt_response.length < 24) {
695 mux_printf(mux_id, "Error: hex decode of %s failed! (only got %d bytes, needed at least 24)\n.\n",
697 (int)nt_response.length);
698 nt_response = data_blob(NULL, 0);
700 } else if (strequal(request, "LANMAN-Response")) {
701 lm_response = strhex_to_data_blob(parameter);
702 if (lm_response.length != 24) {
703 mux_printf(mux_id, "Error: hex decode of %s failed! (got %d bytes, expected 24)\n.\n",
705 (int)lm_response.length);
706 lm_response = data_blob(NULL, 0);
708 } else if (strequal(request, "Password")) {
709 plaintext_password = smb_xstrdup(parameter);
710 } else if (strequal(request, "NT-Domain")) {
711 domain = smb_xstrdup(parameter);
712 } else if (strequal(request, "Username")) {
713 username = smb_xstrdup(parameter);
714 } else if (strequal(request, "Full-Username")) {
715 full_username = smb_xstrdup(parameter);
716 } else if (strequal(request, "Request-User-Session-Key")) {
717 ntlm_server_1_user_session_key = strequal(parameter, "Yes");
718 } else if (strequal(request, "Request-LanMan-Session-Key")) {
719 ntlm_server_1_lm_session_key = strequal(parameter, "Yes");
721 mux_printf(mux_id, "Error: Unknown request %s\n.\n", request);
725 static void manage_squid_request(enum stdio_helper_mode helper_mode,
726 stdio_helper_function fn)
728 char buf[SQUID_BUFFER_SIZE+1];
734 unsigned int max_mux;
735 void **private_pointers;
738 static struct mux_private *mux_private;
739 static void *normal_private;
742 /* this is not a typo - x_fgets doesn't work too well under squid */
743 if (fgets(buf, sizeof(buf)-1, stdin) == NULL) {
745 DEBUG(1, ("fgets() failed! dying..... errno=%d (%s)\n", ferror(stdin),
746 strerror(ferror(stdin))));
748 exit(1); /* BIIG buffer */
753 c=memchr(buf,'\n',sizeof(buf)-1);
762 DEBUG(0, ("Oversized message\n"));
763 x_fprintf(x_stdout, "ERR\n");
768 DEBUG(10, ("Got '%s' from squid (length: %d).\n",buf,length));
770 if (buf[0] == '\0') {
771 DEBUG(0, ("Invalid Request (empty)\n"));
772 x_fprintf(x_stdout, "ERR\n");
777 if (sscanf(buf, "%u ", &mux_id) != 1) {
778 DEBUG(0, ("Invalid Request - no multiplex id\n"));
779 x_fprintf(x_stdout, "ERR\n");
783 mux_private = talloc(NULL, struct mux_private);
784 mux_private->max_mux = 0;
785 mux_private->private_pointers = NULL;
788 c=memchr(buf,' ',sizeof(buf)-1);
790 if (mux_id >= mux_private->max_mux) {
791 unsigned int prev_max = mux_private->max_mux;
792 mux_private->max_mux = mux_id + 1;
793 mux_private->private_pointers
794 = talloc_realloc(mux_private,
795 mux_private->private_pointers,
796 void *, mux_private->max_mux);
797 memset(&mux_private->private_pointers[prev_max], '\0',
798 (sizeof(*mux_private->private_pointers) * (mux_private->max_mux - prev_max)));
801 private = &mux_private->private_pointers[mux_id];
804 private = &normal_private;
807 fn(helper_mode, c, length, private, mux_id);
810 static void squid_stream(enum stdio_helper_mode stdio_mode,
811 stdio_helper_function fn) {
812 /* initialize FDescs */
813 x_setbuf(x_stdout, NULL);
814 x_setbuf(x_stderr, NULL);
816 manage_squid_request(stdio_mode, fn);
833 OPT_USER_SESSION_KEY,
835 OPT_REQUIRE_MEMBERSHIP,
839 int main(int argc, const char **argv)
841 static const char *helper_protocol;
846 /* NOTE: DO NOT change this interface without considering the implications!
847 This is an external interface, which other programs will use to interact
851 /* We do not use single-letter command abbreviations, because they harm future
852 interface stability. */
854 struct poptOption long_options[] = {
856 { "helper-protocol", 0, POPT_ARG_STRING, &helper_protocol, OPT_DOMAIN, "operate as a stdio-based helper", "helper protocol to use"},
857 { "domain", 0, POPT_ARG_STRING, &opt_domain, OPT_DOMAIN, "domain name"},
858 { "workstation", 0, POPT_ARG_STRING, &opt_workstation, OPT_WORKSTATION, "workstation"},
859 { "username", 0, POPT_ARG_STRING, &opt_username, OPT_PASSWORD, "Username"},
860 { "password", 0, POPT_ARG_STRING, &opt_password, OPT_PASSWORD, "User's plaintext password"},
861 { "multiplex", 0, POPT_ARG_NONE, &opt_multiplex, OPT_MULTIPLEX, "Multiplex Mode"},
866 /* Samba client initialisation */
868 setup_logging("ntlm_auth", DEBUG_STDERR);
870 if (!lp_load(dyn_CONFIGFILE, True, False, False)) {
871 d_fprintf(stderr, "wbinfo: error opening config file %s. Error was %s\n",
872 dyn_CONFIGFILE, strerror(errno));
878 pc = poptGetContext("ntlm_auth", argc, argv, long_options, 0);
880 /* Parse command line options */
883 poptPrintHelp(pc, stderr, 0);
887 pc = poptGetContext(NULL, argc, (const char **)argv, long_options,
888 POPT_CONTEXT_KEEP_FIRST);
890 while((opt = poptGetNextOpt(pc)) != -1) {
896 fprintf(stderr, "%s: %s\n",
897 poptBadOption(pc, POPT_BADOPTION_NOALIAS),
902 ntlm_auth_init_subsystems;
905 if (opt_domain == NULL) {
906 opt_domain = lp_workgroup();
909 if (helper_protocol) {
911 for (i=0; i<NUM_HELPER_MODES; i++) {
912 if (strcmp(helper_protocol, stdio_helper_protocols[i].name) == 0) {
913 squid_stream(stdio_helper_protocols[i].mode, stdio_helper_protocols[i].fn);
917 x_fprintf(x_stderr, "unknown helper protocol [%s]\n\nValid helper protools:\n\n", helper_protocol);
919 for (i=0; i<NUM_HELPER_MODES; i++) {
920 x_fprintf(x_stderr, "%s\n", stdio_helper_protocols[i].name);
927 x_fprintf(x_stderr, "username must be specified!\n\n");
928 poptPrintHelp(pc, stderr, 0);
932 if (opt_workstation == NULL) {
933 opt_workstation = lp_netbios_name();
937 opt_password = getpass("password: ");
943 asprintf(&user, "%s%c%s", opt_domain, *lp_winbind_separator(), opt_username);
944 if (!check_plaintext_auth(user, opt_password, True)) {