| 1 | /* | 
|---|
| 2 | Unix SMB/CIFS implementation. | 
|---|
| 3 |  | 
|---|
| 4 | Async helpers for blocking functions | 
|---|
| 5 |  | 
|---|
| 6 | Copyright (C) Volker Lendecke 2005 | 
|---|
| 7 | Copyright (C) Gerald Carter 2006 | 
|---|
| 8 |  | 
|---|
| 9 | This program is free software; you can redistribute it and/or modify | 
|---|
| 10 | it under the terms of the GNU General Public License as published by | 
|---|
| 11 | the Free Software Foundation; either version 3 of the License, or | 
|---|
| 12 | (at your option) any later version. | 
|---|
| 13 |  | 
|---|
| 14 | This program is distributed in the hope that it will be useful, | 
|---|
| 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 17 | GNU General Public License for more details. | 
|---|
| 18 |  | 
|---|
| 19 | You should have received a copy of the GNU General Public License | 
|---|
| 20 | along with this program.  If not, see <http://www.gnu.org/licenses/>. | 
|---|
| 21 | */ | 
|---|
| 22 |  | 
|---|
| 23 | #include "includes.h" | 
|---|
| 24 | #include "winbindd.h" | 
|---|
| 25 |  | 
|---|
| 26 | #undef DBGC_CLASS | 
|---|
| 27 | #define DBGC_CLASS DBGC_WINBIND | 
|---|
| 28 |  | 
|---|
| 29 | bool print_sidlist(TALLOC_CTX *mem_ctx, const DOM_SID *sids, | 
|---|
| 30 | size_t num_sids, char **result, ssize_t *len) | 
|---|
| 31 | { | 
|---|
| 32 | size_t i; | 
|---|
| 33 | size_t buflen = 0; | 
|---|
| 34 |  | 
|---|
| 35 | *len = 0; | 
|---|
| 36 | *result = NULL; | 
|---|
| 37 | for (i=0; i<num_sids; i++) { | 
|---|
| 38 | fstring tmp; | 
|---|
| 39 | sprintf_append(mem_ctx, result, len, &buflen, | 
|---|
| 40 | "%s\n", sid_to_fstring(tmp, &sids[i])); | 
|---|
| 41 | } | 
|---|
| 42 |  | 
|---|
| 43 | if ((num_sids != 0) && (*result == NULL)) { | 
|---|
| 44 | return False; | 
|---|
| 45 | } | 
|---|
| 46 |  | 
|---|
| 47 | return True; | 
|---|
| 48 | } | 
|---|
| 49 |  | 
|---|
| 50 | bool parse_sidlist(TALLOC_CTX *mem_ctx, const char *sidstr, | 
|---|
| 51 | DOM_SID **sids, size_t *num_sids) | 
|---|
| 52 | { | 
|---|
| 53 | const char *p, *q; | 
|---|
| 54 |  | 
|---|
| 55 | p = sidstr; | 
|---|
| 56 | if (p == NULL) | 
|---|
| 57 | return False; | 
|---|
| 58 |  | 
|---|
| 59 | while (p[0] != '\0') { | 
|---|
| 60 | fstring tmp; | 
|---|
| 61 | size_t sidlen; | 
|---|
| 62 | DOM_SID sid; | 
|---|
| 63 | q = strchr(p, '\n'); | 
|---|
| 64 | if (q == NULL) { | 
|---|
| 65 | DEBUG(0, ("Got invalid sidstr: %s\n", p)); | 
|---|
| 66 | return False; | 
|---|
| 67 | } | 
|---|
| 68 | sidlen = PTR_DIFF(q, p); | 
|---|
| 69 | if (sidlen >= sizeof(tmp)-1) { | 
|---|
| 70 | return false; | 
|---|
| 71 | } | 
|---|
| 72 | memcpy(tmp, p, sidlen); | 
|---|
| 73 | tmp[sidlen] = '\0'; | 
|---|
| 74 | q += 1; | 
|---|
| 75 | if (!string_to_sid(&sid, tmp)) { | 
|---|
| 76 | DEBUG(0, ("Could not parse sid %s\n", p)); | 
|---|
| 77 | return False; | 
|---|
| 78 | } | 
|---|
| 79 | if (!NT_STATUS_IS_OK(add_sid_to_array(mem_ctx, &sid, sids, | 
|---|
| 80 | num_sids))) | 
|---|
| 81 | { | 
|---|
| 82 | return False; | 
|---|
| 83 | } | 
|---|
| 84 | p = q; | 
|---|
| 85 | } | 
|---|
| 86 | return True; | 
|---|
| 87 | } | 
|---|
| 88 |  | 
|---|
| 89 | enum winbindd_result winbindd_dual_ping(struct winbindd_domain *domain, | 
|---|
| 90 | struct winbindd_cli_state *state) | 
|---|
| 91 | { | 
|---|
| 92 | return WINBINDD_OK; | 
|---|
| 93 | } | 
|---|