r19787: get winbindd compiling
[Samba.git] / source / nsswitch / winbindd_user.c
blob9c60c73fc4da8e236185d6fc47cdfe439a2314a4
1 /*
2 Unix SMB/CIFS implementation.
4 Winbind daemon - user related functions
6 Copyright (C) Tim Potter 2000
7 Copyright (C) Jeremy Allison 2001.
8 Copyright (C) Gerald (Jerry) Carter 2003.
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.
25 #include "includes.h"
26 #include "winbindd.h"
28 #undef DBGC_CLASS
29 #define DBGC_CLASS DBGC_WINBIND
31 static BOOL fillup_pw_field(const char *lp_template,
32 const char *username,
33 const char *domname,
34 uid_t uid,
35 gid_t gid,
36 const char *in,
37 fstring out)
39 char *templ;
41 if (out == NULL)
42 return False;
44 if (in && !strequal(in,"") && lp_security() == SEC_ADS && (get_nss_info(domname))) {
45 safe_strcpy(out, in, sizeof(fstring) - 1);
46 return True;
49 /* Home directory and shell - use template config parameters. The
50 defaults are /tmp for the home directory and /bin/false for
51 shell. */
53 /* The substitution of %U and %D in the 'template homedir' is done
54 by talloc_sub_specified() below. */
56 templ = talloc_sub_specified(NULL, lp_template, username, domname,
57 uid, gid);
59 if (!templ)
60 return False;
62 safe_strcpy(out, templ, sizeof(fstring) - 1);
63 TALLOC_FREE(templ);
65 return True;
68 /* Fill a pwent structure with information we have obtained */
70 static BOOL winbindd_fill_pwent(char *dom_name, char *user_name,
71 DOM_SID *user_sid, DOM_SID *group_sid,
72 char *full_name, char *homedir, char *shell,
73 struct winbindd_pw *pw)
75 fstring output_username;
76 fstring sid_string;
78 if (!pw || !dom_name || !user_name)
79 return False;
81 /* Resolve the uid number */
83 if (!NT_STATUS_IS_OK(idmap_sid_to_uid(user_sid, &pw->pw_uid, 0))) {
84 DEBUG(1, ("error getting user id for sid %s\n", sid_to_string(sid_string, user_sid)));
85 return False;
88 /* Resolve the gid number */
90 if (!NT_STATUS_IS_OK(idmap_sid_to_gid(group_sid, &pw->pw_gid, 0))) {
91 DEBUG(1, ("error getting group id for sid %s\n", sid_to_string(sid_string, group_sid)));
92 return False;
95 strlower_m(user_name);
97 /* Username */
99 fill_domain_username(output_username, dom_name, user_name, True);
101 safe_strcpy(pw->pw_name, output_username, sizeof(pw->pw_name) - 1);
103 /* Full name (gecos) */
105 safe_strcpy(pw->pw_gecos, full_name, sizeof(pw->pw_gecos) - 1);
107 /* Home directory and shell - use template config parameters. The
108 defaults are /tmp for the home directory and /bin/false for
109 shell. */
111 if (!fillup_pw_field(lp_template_homedir(), user_name, dom_name,
112 pw->pw_uid, pw->pw_gid, homedir, pw->pw_dir))
113 return False;
115 if (!fillup_pw_field(lp_template_shell(), user_name, dom_name,
116 pw->pw_uid, pw->pw_gid, shell, pw->pw_shell))
117 return False;
119 /* Password - set to "*" as we can't generate anything useful here.
120 Authentication can be done using the pam_winbind module. */
122 safe_strcpy(pw->pw_passwd, "*", sizeof(pw->pw_passwd) - 1);
124 return True;
127 /* Wrapper for domain->methods->query_user, only on the parent->child pipe */
129 enum winbindd_result winbindd_dual_userinfo(struct winbindd_domain *domain,
130 struct winbindd_cli_state *state)
132 DOM_SID sid;
133 WINBIND_USERINFO user_info;
134 NTSTATUS status;
136 /* Ensure null termination */
137 state->request.data.sid[sizeof(state->request.data.sid)-1]='\0';
139 DEBUG(3, ("[%5lu]: lookupsid %s\n", (unsigned long)state->pid,
140 state->request.data.sid));
142 if (!string_to_sid(&sid, state->request.data.sid)) {
143 DEBUG(5, ("%s not a SID\n", state->request.data.sid));
144 return WINBINDD_ERROR;
147 status = domain->methods->query_user(domain, state->mem_ctx,
148 &sid, &user_info);
149 if (!NT_STATUS_IS_OK(status)) {
150 DEBUG(1, ("error getting user info for sid %s\n",
151 sid_string_static(&sid)));
152 return WINBINDD_ERROR;
155 fstrcpy(state->response.data.user_info.acct_name, user_info.acct_name);
156 fstrcpy(state->response.data.user_info.full_name, user_info.full_name);
157 fstrcpy(state->response.data.user_info.homedir, user_info.homedir);
158 fstrcpy(state->response.data.user_info.shell, user_info.shell);
159 if (!sid_peek_check_rid(&domain->sid, &user_info.group_sid,
160 &state->response.data.user_info.group_rid)) {
161 DEBUG(1, ("Could not extract group rid out of %s\n",
162 sid_string_static(&sid)));
163 return WINBINDD_ERROR;
166 return WINBINDD_OK;
169 struct getpwsid_state {
170 struct winbindd_cli_state *state;
171 struct winbindd_domain *domain;
172 char *username;
173 char *fullname;
174 char *homedir;
175 char *shell;
176 DOM_SID user_sid;
177 uid_t uid;
178 DOM_SID group_sid;
179 gid_t gid;
182 static void getpwsid_queryuser_recv(void *private_data, BOOL success,
183 const char *acct_name,
184 const char *full_name,
185 const char *homedir,
186 const char *shell,
187 uint32 group_rid);
188 static void getpwsid_sid2uid_recv(void *private_data, BOOL success, uid_t uid);
189 static void getpwsid_sid2gid_recv(void *private_data, BOOL success, gid_t gid);
191 static void winbindd_getpwsid(struct winbindd_cli_state *state,
192 const DOM_SID *sid)
194 struct getpwsid_state *s;
196 s = TALLOC_ZERO_P(state->mem_ctx, struct getpwsid_state);
197 if (s == NULL) {
198 DEBUG(0, ("talloc failed\n"));
199 goto error;
202 s->state = state;
203 s->domain = find_domain_from_sid_noinit(sid);
204 if (s->domain == NULL) {
205 DEBUG(3, ("Could not find domain for sid %s\n",
206 sid_string_static(sid)));
207 goto error;
210 sid_copy(&s->user_sid, sid);
212 query_user_async(s->state->mem_ctx, s->domain, sid,
213 getpwsid_queryuser_recv, s);
214 return;
216 error:
217 request_error(state);
220 static void getpwsid_queryuser_recv(void *private_data, BOOL success,
221 const char *acct_name,
222 const char *full_name,
223 const char *homedir,
224 const char *shell,
225 uint32 group_rid)
227 fstring username;
228 struct getpwsid_state *s =
229 talloc_get_type_abort(private_data, struct getpwsid_state);
231 if (!success) {
232 DEBUG(5, ("Could not query domain %s SID %s\n", s->domain->name,
233 sid_string_static(&s->user_sid)));
234 request_error(s->state);
235 return;
238 fstrcpy( username, acct_name );
239 strlower_m( username );
240 s->username = talloc_strdup(s->state->mem_ctx, username);
241 s->fullname = talloc_strdup(s->state->mem_ctx, full_name);
242 s->homedir = talloc_strdup(s->state->mem_ctx, homedir);
243 s->shell = talloc_strdup(s->state->mem_ctx, shell);
244 sid_copy(&s->group_sid, &s->domain->sid);
245 sid_append_rid(&s->group_sid, group_rid);
247 winbindd_sid2uid_async(s->state->mem_ctx, &s->user_sid,
248 getpwsid_sid2uid_recv, s);
251 static void getpwsid_sid2uid_recv(void *private_data, BOOL success, uid_t uid)
253 struct getpwsid_state *s =
254 talloc_get_type_abort(private_data, struct getpwsid_state);
256 if (!success) {
257 DEBUG(5, ("Could not query user's %s\\%s uid\n",
258 s->domain->name, s->username));
259 request_error(s->state);
260 return;
263 s->uid = uid;
264 winbindd_sid2gid_async(s->state->mem_ctx, &s->group_sid,
265 getpwsid_sid2gid_recv, s);
268 static void getpwsid_sid2gid_recv(void *private_data, BOOL success, gid_t gid)
270 struct getpwsid_state *s =
271 talloc_get_type_abort(private_data, struct getpwsid_state);
272 struct winbindd_pw *pw;
273 fstring output_username;
275 if (!success) {
276 DEBUG(5, ("Could not query user's %s\\%s\n gid",
277 s->domain->name, s->username));
278 goto failed;
281 s->gid = gid;
283 pw = &s->state->response.data.pw;
284 pw->pw_uid = s->uid;
285 pw->pw_gid = s->gid;
286 fill_domain_username(output_username, s->domain->name, s->username, True);
287 safe_strcpy(pw->pw_name, output_username, sizeof(pw->pw_name) - 1);
288 safe_strcpy(pw->pw_gecos, s->fullname, sizeof(pw->pw_gecos) - 1);
290 if (!fillup_pw_field(lp_template_homedir(), s->username, s->domain->name,
291 pw->pw_uid, pw->pw_gid, s->homedir, pw->pw_dir)) {
292 DEBUG(5, ("Could not compose homedir\n"));
293 goto failed;
296 if (!fillup_pw_field(lp_template_shell(), s->username, s->domain->name,
297 pw->pw_uid, pw->pw_gid, s->shell, pw->pw_shell)) {
298 DEBUG(5, ("Could not compose shell\n"));
299 goto failed;
302 /* Password - set to "*" as we can't generate anything useful here.
303 Authentication can be done using the pam_winbind module. */
305 safe_strcpy(pw->pw_passwd, "*", sizeof(pw->pw_passwd) - 1);
307 request_ok(s->state);
308 return;
310 failed:
311 request_error(s->state);
314 /* Return a password structure from a username. */
316 static void getpwnam_name2sid_recv(void *private_data, BOOL success,
317 const DOM_SID *sid, enum SID_NAME_USE type);
319 void winbindd_getpwnam(struct winbindd_cli_state *state)
321 struct winbindd_domain *domain;
322 fstring domname, username;
324 /* Ensure null termination */
325 state->request.data.username[sizeof(state->request.data.username)-1]='\0';
327 DEBUG(3, ("[%5lu]: getpwnam %s\n", (unsigned long)state->pid,
328 state->request.data.username));
330 if (!parse_domain_user(state->request.data.username, domname,
331 username)) {
332 DEBUG(5, ("Could not parse domain user: %s\n",
333 state->request.data.username));
334 request_error(state);
335 return;
338 /* Get info for the domain */
340 domain = find_domain_from_name(domname);
342 if (domain == NULL) {
343 DEBUG(7, ("could not find domain entry for domain %s\n",
344 domname));
345 request_error(state);
346 return;
349 if ( strequal(domname, lp_workgroup()) && lp_winbind_trusted_domains_only() ) {
350 DEBUG(7,("winbindd_getpwnam: My domain -- rejecting getpwnam() for %s\\%s.\n",
351 domname, username));
352 request_error(state);
353 return;
356 /* Get rid and name type from name. The following costs 1 packet */
358 winbindd_lookupname_async(state->mem_ctx, domname, username,
359 getpwnam_name2sid_recv, state);
362 static void getpwnam_name2sid_recv(void *private_data, BOOL success,
363 const DOM_SID *sid, enum SID_NAME_USE type)
365 struct winbindd_cli_state *state =
366 (struct winbindd_cli_state *)private_data;
368 if (!success) {
369 DEBUG(5, ("Could not lookup name for user %s\n",
370 state->request.data.username));
371 request_error(state);
372 return;
375 if ((type != SID_NAME_USER) && (type != SID_NAME_COMPUTER)) {
376 DEBUG(5, ("%s is not a user\n", state->request.data.username));
377 request_error(state);
378 return;
381 winbindd_getpwsid(state, sid);
384 static void getpwuid_recv(void *private_data, BOOL success, const char *sid)
386 struct winbindd_cli_state *state =
387 (struct winbindd_cli_state *)private_data;
388 DOM_SID user_sid;
390 if (!success) {
391 DEBUG(10,("uid2sid_recv: uid [%lu] to sid mapping failed\n.",
392 (unsigned long)(state->request.data.uid)));
393 request_error(state);
394 return;
397 DEBUG(10,("uid2sid_recv: uid %lu has sid %s\n",
398 (unsigned long)(state->request.data.uid), sid));
400 string_to_sid(&user_sid, sid);
401 winbindd_getpwsid(state, &user_sid);
404 /* Return a password structure given a uid number */
405 void winbindd_getpwuid(struct winbindd_cli_state *state)
407 DOM_SID user_sid;
408 NTSTATUS status;
410 /* Bug out if the uid isn't in the winbind range */
411 if ((state->request.data.uid < server_state.uid_low ) ||
412 (state->request.data.uid > server_state.uid_high)) {
413 request_error(state);
414 return;
417 DEBUG(3, ("[%5lu]: getpwuid %lu\n", (unsigned long)state->pid,
418 (unsigned long)state->request.data.uid));
420 status = idmap_uid_to_sid(&user_sid, state->request.data.uid,
421 IDMAP_FLAG_QUERY_ONLY | IDMAP_FLAG_CACHE_ONLY);
423 if (NT_STATUS_IS_OK(status)) {
424 winbindd_getpwsid(state, &user_sid);
425 return;
428 DEBUG(10,("Could not find SID for uid %lu in the cache. Querying idmap backend\n",
429 (unsigned long)state->request.data.uid));
431 winbindd_uid2sid_async(state->mem_ctx, state->request.data.uid, getpwuid_recv, state);
435 * set/get/endpwent functions
438 /* Rewind file pointer for ntdom passwd database */
440 static BOOL winbindd_setpwent_internal(struct winbindd_cli_state *state)
442 struct winbindd_domain *domain;
444 DEBUG(3, ("[%5lu]: setpwent\n", (unsigned long)state->pid));
446 /* Check user has enabled this */
448 if (!lp_winbind_enum_users()) {
449 return False;
452 /* Free old static data if it exists */
454 if (state->getpwent_state != NULL) {
455 free_getent_state(state->getpwent_state);
456 state->getpwent_state = NULL;
459 #if 0 /* JERRY */
460 /* add any local users we have */
462 if ( (domain_state = (struct getent_state *)malloc(sizeof(struct getent_state))) == NULL )
463 return False;
465 ZERO_STRUCTP(domain_state);
467 /* Add to list of open domains */
469 DLIST_ADD(state->getpwent_state, domain_state);
470 #endif
472 /* Create sam pipes for each domain we know about */
474 for(domain = domain_list(); domain != NULL; domain = domain->next) {
475 struct getent_state *domain_state;
478 /* don't add our domaina if we are a PDC or if we
479 are a member of a Samba domain */
481 if ( (IS_DC || lp_winbind_trusted_domains_only())
482 && strequal(domain->name, lp_workgroup()) )
484 continue;
487 /* Create a state record for this domain */
489 if ((domain_state = SMB_MALLOC_P(struct getent_state)) == NULL) {
490 DEBUG(0, ("malloc failed\n"));
491 return False;
494 ZERO_STRUCTP(domain_state);
496 fstrcpy(domain_state->domain_name, domain->name);
498 /* Add to list of open domains */
500 DLIST_ADD(state->getpwent_state, domain_state);
503 state->getpwent_initialized = True;
504 return True;
507 void winbindd_setpwent(struct winbindd_cli_state *state)
509 if (winbindd_setpwent_internal(state)) {
510 request_ok(state);
511 } else {
512 request_error(state);
516 /* Close file pointer to ntdom passwd database */
518 void winbindd_endpwent(struct winbindd_cli_state *state)
520 DEBUG(3, ("[%5lu]: endpwent\n", (unsigned long)state->pid));
522 free_getent_state(state->getpwent_state);
523 state->getpwent_initialized = False;
524 state->getpwent_state = NULL;
525 request_ok(state);
528 /* Get partial list of domain users for a domain. We fill in the sam_entries,
529 and num_sam_entries fields with domain user information. The dispinfo_ndx
530 field is incremented to the index of the next user to fetch. Return True if
531 some users were returned, False otherwise. */
533 static BOOL get_sam_user_entries(struct getent_state *ent, TALLOC_CTX *mem_ctx)
535 NTSTATUS status;
536 uint32 num_entries;
537 WINBIND_USERINFO *info;
538 struct getpwent_user *name_list = NULL;
539 struct winbindd_domain *domain;
540 struct winbindd_methods *methods;
541 unsigned int i;
543 if (ent->num_sam_entries)
544 return False;
546 if (!(domain = find_domain_from_name(ent->domain_name))) {
547 DEBUG(3, ("no such domain %s in get_sam_user_entries\n",
548 ent->domain_name));
549 return False;
552 methods = domain->methods;
554 /* Free any existing user info */
556 SAFE_FREE(ent->sam_entries);
557 ent->num_sam_entries = 0;
559 /* Call query_user_list to get a list of usernames and user rids */
561 num_entries = 0;
563 status = methods->query_user_list(domain, mem_ctx, &num_entries,
564 &info);
566 if (!NT_STATUS_IS_OK(status)) {
567 DEBUG(10,("get_sam_user_entries: query_user_list failed with %s\n",
568 nt_errstr(status) ));
569 return False;
572 if (num_entries) {
573 name_list = SMB_REALLOC_ARRAY(name_list, struct getpwent_user, ent->num_sam_entries + num_entries);
575 if (!name_list) {
576 DEBUG(0,("get_sam_user_entries realloc failed.\n"));
577 return False;
581 for (i = 0; i < num_entries; i++) {
582 /* Store account name and gecos */
583 if (!info[i].acct_name) {
584 fstrcpy(name_list[ent->num_sam_entries + i].name, "");
585 } else {
586 fstrcpy(name_list[ent->num_sam_entries + i].name,
587 info[i].acct_name);
589 if (!info[i].full_name) {
590 fstrcpy(name_list[ent->num_sam_entries + i].gecos, "");
591 } else {
592 fstrcpy(name_list[ent->num_sam_entries + i].gecos,
593 info[i].full_name);
595 if (!info[i].homedir) {
596 fstrcpy(name_list[ent->num_sam_entries + i].homedir, "");
597 } else {
598 fstrcpy(name_list[ent->num_sam_entries + i].homedir,
599 info[i].homedir);
601 if (!info[i].shell) {
602 fstrcpy(name_list[ent->num_sam_entries + i].shell, "");
603 } else {
604 fstrcpy(name_list[ent->num_sam_entries + i].shell,
605 info[i].shell);
609 /* User and group ids */
610 sid_copy(&name_list[ent->num_sam_entries+i].user_sid,
611 &info[i].user_sid);
612 sid_copy(&name_list[ent->num_sam_entries+i].group_sid,
613 &info[i].group_sid);
616 ent->num_sam_entries += num_entries;
618 /* Fill in remaining fields */
620 ent->sam_entries = name_list;
621 ent->sam_entry_index = 0;
622 return ent->num_sam_entries > 0;
625 /* Fetch next passwd entry from ntdom database */
627 #define MAX_GETPWENT_USERS 500
629 void winbindd_getpwent(struct winbindd_cli_state *state)
631 struct getent_state *ent;
632 struct winbindd_pw *user_list;
633 int num_users, user_list_ndx = 0, i;
635 DEBUG(3, ("[%5lu]: getpwent\n", (unsigned long)state->pid));
637 /* Check user has enabled this */
639 if (!lp_winbind_enum_users()) {
640 request_error(state);
641 return;
644 /* Allocate space for returning a chunk of users */
646 num_users = MIN(MAX_GETPWENT_USERS, state->request.data.num_entries);
648 if ((state->response.extra_data.data = SMB_MALLOC_ARRAY(struct winbindd_pw, num_users)) == NULL) {
649 request_error(state);
650 return;
653 memset(state->response.extra_data.data, 0, num_users *
654 sizeof(struct winbindd_pw));
656 user_list = (struct winbindd_pw *)state->response.extra_data.data;
658 if (!state->getpwent_initialized)
659 winbindd_setpwent_internal(state);
661 if (!(ent = state->getpwent_state)) {
662 request_error(state);
663 return;
666 /* Start sending back users */
668 for (i = 0; i < num_users; i++) {
669 struct getpwent_user *name_list = NULL;
670 uint32 result;
672 /* Do we need to fetch another chunk of users? */
674 if (ent->num_sam_entries == ent->sam_entry_index) {
676 while(ent &&
677 !get_sam_user_entries(ent, state->mem_ctx)) {
678 struct getent_state *next_ent;
680 /* Free state information for this domain */
682 SAFE_FREE(ent->sam_entries);
684 next_ent = ent->next;
685 DLIST_REMOVE(state->getpwent_state, ent);
687 SAFE_FREE(ent);
688 ent = next_ent;
691 /* No more domains */
693 if (!ent)
694 break;
697 name_list = (struct getpwent_user *)ent->sam_entries;
699 /* Lookup user info */
701 result = winbindd_fill_pwent(
702 ent->domain_name,
703 name_list[ent->sam_entry_index].name,
704 &name_list[ent->sam_entry_index].user_sid,
705 &name_list[ent->sam_entry_index].group_sid,
706 name_list[ent->sam_entry_index].gecos,
707 name_list[ent->sam_entry_index].homedir,
708 name_list[ent->sam_entry_index].shell,
709 &user_list[user_list_ndx]);
711 ent->sam_entry_index++;
713 /* Add user to return list */
715 if (result) {
717 user_list_ndx++;
718 state->response.data.num_entries++;
719 state->response.length +=
720 sizeof(struct winbindd_pw);
722 } else
723 DEBUG(1, ("could not lookup domain user %s\n",
724 name_list[ent->sam_entry_index].name));
727 /* Out of domains */
729 if (user_list_ndx > 0)
730 request_ok(state);
731 else
732 request_error(state);
735 /* List domain users without mapping to unix ids */
737 void winbindd_list_users(struct winbindd_cli_state *state)
739 struct winbindd_domain *domain;
740 WINBIND_USERINFO *info;
741 const char *which_domain;
742 uint32 num_entries = 0, total_entries = 0;
743 char *extra_data = NULL;
744 int extra_data_len = 0;
745 enum winbindd_result rv = WINBINDD_ERROR;
747 DEBUG(3, ("[%5lu]: list users\n", (unsigned long)state->pid));
749 /* Ensure null termination */
750 state->request.domain_name[sizeof(state->request.domain_name)-1]='\0';
751 which_domain = state->request.domain_name;
753 /* Enumerate over trusted domains */
755 for (domain = domain_list(); domain; domain = domain->next) {
756 NTSTATUS status;
757 struct winbindd_methods *methods;
758 unsigned int i;
760 /* if we have a domain name restricting the request and this
761 one in the list doesn't match, then just bypass the remainder
762 of the loop */
764 if ( *which_domain && !strequal(which_domain, domain->name) )
765 continue;
767 methods = domain->methods;
769 /* Query display info */
770 status = methods->query_user_list(domain, state->mem_ctx,
771 &num_entries, &info);
773 if (!NT_STATUS_IS_OK(status)) {
774 continue;
777 if (num_entries == 0)
778 continue;
780 /* Allocate some memory for extra data */
781 total_entries += num_entries;
783 extra_data = (char *)SMB_REALLOC(
784 extra_data, sizeof(fstring) * total_entries);
786 if (!extra_data) {
787 DEBUG(0,("failed to enlarge buffer!\n"));
788 goto done;
791 /* Pack user list into extra data fields */
793 for (i = 0; i < num_entries; i++) {
794 fstring acct_name, name;
796 if (!info[i].acct_name) {
797 fstrcpy(acct_name, "");
798 } else {
799 fstrcpy(acct_name, info[i].acct_name);
802 fill_domain_username(name, domain->name, acct_name, True);
804 /* Append to extra data */
805 memcpy(&extra_data[extra_data_len], name,
806 strlen(name));
807 extra_data_len += strlen(name);
808 extra_data[extra_data_len++] = ',';
812 /* Assign extra_data fields in response structure */
814 if (extra_data) {
815 extra_data[extra_data_len - 1] = '\0';
816 state->response.extra_data.data = extra_data;
817 state->response.length += extra_data_len;
820 /* No domains responded but that's still OK so don't return an
821 error. */
823 rv = WINBINDD_OK;
825 done:
827 if (rv == WINBINDD_OK)
828 request_ok(state);
829 else
830 request_error(state);