Changeset 740 for vendor/current/libcli
- Timestamp:
- Nov 14, 2012, 12:59:34 PM (13 years ago)
- Location:
- vendor/current/libcli
- Files:
-
- 61 added
- 16 deleted
- 49 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/libcli/auth/credentials.c
r587 r740 250 250 const uint8_t session_key[16]) 251 251 { 252 struct netlogon_creds_CredentialState *creds = talloc(mem_ctx, struct netlogon_creds_CredentialState); 253 252 struct netlogon_creds_CredentialState *creds; 253 254 creds = talloc_zero(mem_ctx, struct netlogon_creds_CredentialState); 254 255 if (!creds) { 255 256 return NULL; -
vendor/current/libcli/auth/credentials.h
r414 r740 69 69 #define NETLOGON_NEG_AUTH2_ADS_FLAGS (0x200fbffb | NETLOGON_NEG_ARCFOUR | NETLOGON_NEG_128BIT | NETLOGON_NEG_SCHANNEL) 70 70 71 #define NETLOGON_NEG_AUTH2_RODC_FLAGS (NETLOGON_NEG_AUTH2_ADS_FLAGS | NETLOGON_NEG_RODC_PASSTHROUGH) 71 72 -
vendor/current/libcli/auth/msrpc_parse.c
r414 r740 41 41 C = constant ascii string 42 42 */ 43 boolmsrpc_gen(TALLOC_CTX *mem_ctx,43 NTSTATUS msrpc_gen(TALLOC_CTX *mem_ctx, 44 44 DATA_BLOB *blob, 45 45 const char *format, ...) … … 58 58 59 59 pointers = talloc_array(mem_ctx, DATA_BLOB, strlen(format)); 60 if (!pointers) { 61 return NT_STATUS_NO_MEMORY; 62 } 60 63 intargs = talloc_array(pointers, int, strlen(format)); 64 if (!intargs) { 65 return NT_STATUS_NO_MEMORY; 66 } 61 67 62 68 /* first scan the format to work out the header and body size */ … … 73 79 if (!ret) { 74 80 va_end(ap); 75 return false;81 return map_nt_error_from_unix(errno); 76 82 } 77 83 pointers[i].length = n; … … 87 93 if (!ret) { 88 94 va_end(ap); 89 return false;95 return map_nt_error_from_unix(errno); 90 96 } 91 97 pointers[i].length = n; … … 103 109 if (!ret) { 104 110 va_end(ap); 105 return false;111 return map_nt_error_from_unix(errno); 106 112 } 107 113 pointers[i].length = n; … … 133 139 head_size += pointers[i].length; 134 140 break; 141 default: 142 va_end(ap); 143 return NT_STATUS_INVALID_PARAMETER; 135 144 } 136 145 } 137 146 va_end(ap); 147 148 if (head_size + data_size == 0) { 149 return NT_STATUS_INVALID_PARAMETER; 150 } 138 151 139 152 /* allocate the space, then scan the format again to fill in the values */ 140 153 *blob = data_blob_talloc(mem_ctx, NULL, head_size + data_size); 141 154 if (!blob->data) { 155 return NT_STATUS_NO_MEMORY; 156 } 142 157 head_ofs = 0; 143 158 data_ofs = head_size; … … 175 190 case 'b': 176 191 n = pointers[i].length; 177 memcpy(blob->data + head_ofs, pointers[i].data, n); 192 if (pointers[i].data && n) { 193 /* don't follow null pointers... */ 194 memcpy(blob->data + head_ofs, pointers[i].data, n); 195 } 178 196 head_ofs += n; 179 197 break; … … 183 201 head_ofs += n; 184 202 break; 203 default: 204 va_end(ap); 205 return NT_STATUS_INVALID_PARAMETER; 185 206 } 186 207 } … … 189 210 talloc_free(pointers); 190 211 191 return true;212 return NT_STATUS_OK; 192 213 } 193 214 … … 229 250 bool ret = true; 230 251 252 if (!p) { 253 return false; 254 } 255 231 256 va_start(ap, format); 232 257 for (i=0; format[i]; i++) { … … 334 359 case 'b': 335 360 b = (DATA_BLOB *)va_arg(ap, void *); 336 len1 = va_arg(ap, u int_t);361 len1 = va_arg(ap, unsigned int); 337 362 /* make sure its in the right format - be strict */ 338 363 NEED_DATA(len1); -
vendor/current/libcli/auth/msrpc_parse.h
r414 r740 1 /* 2 Unix SMB/CIFS implementation. 3 simple kerberos5/SPNEGO routines 4 Copyright (C) Andrew Tridgell 2001 5 Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2002 6 Copyright (C) Andrew Bartlett 2002-2003 7 8 This program is free software; you can redistribute it and/or modify 9 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation; either version 3 of the License, or 11 (at your option) any later version. 12 13 This program is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program. If not, see <http://www.gnu.org/licenses/>. 20 */ 21 1 22 #ifndef _LIBCLI_AUTH_MSRPC_PARSE_H__ 2 23 #define _LIBCLI_AUTH_MSRPC_PARSE_H__ … … 12 33 /* The following definitions come from /home/jeremy/src/samba/git/master/source3/../source4/../libcli/auth/msrpc_parse.c */ 13 34 14 boolmsrpc_gen(TALLOC_CTX *mem_ctx,35 NTSTATUS msrpc_gen(TALLOC_CTX *mem_ctx, 15 36 DATA_BLOB *blob, 16 37 const char *format, ...); -
vendor/current/libcli/auth/ntlm_check.c
r414 r740 5 5 Copyright (C) Gerald Carter 2003 6 6 Copyright (C) Luke Kenneth Casson Leighton 1996-2000 7 7 8 8 This program is free software; you can redistribute it and/or modify 9 9 it under the terms of the GNU General Public License as published by 10 10 the Free Software Foundation; either version 3 of the License, or 11 11 (at your option) any later version. 12 12 13 13 This program is distributed in the hope that it will be useful, 14 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 16 GNU General Public License for more details. 17 17 18 18 You should have received a copy of the GNU General Public License 19 19 along with this program. If not, see <http://www.gnu.org/licenses/>. … … 37 37 /* Finish the encryption of part_passwd. */ 38 38 uint8_t p24[24]; 39 39 40 40 if (part_passwd == NULL) { 41 41 DEBUG(10,("No password set - DISALLOWING access\n")); … … 43 43 return false; 44 44 } 45 45 46 46 if (sec_blob->length != 8) { 47 47 DEBUG(0, ("smb_pwd_check_ntlmv1: incorrect challenge size (%lu)\n", … … 49 49 return false; 50 50 } 51 51 52 52 if (nt_response->length != 24) { 53 53 DEBUG(0, ("smb_pwd_check_ntlmv1: incorrect password length (%lu)\n", … … 57 57 58 58 SMBOWFencrypt(part_passwd, sec_blob->data, p24); 59 59 60 60 #if DEBUG_PASSWORD 61 61 DEBUG(100,("Part password (P16) was |\n")); … … 107 107 return false; 108 108 } 109 109 110 110 if (ntv2_response->length < 24) { 111 111 /* We MUST have more than 16 bytes, or the stuff below will go … … 181 181 return false; 182 182 } 183 183 184 184 if (ntv2_response->length < 24) { 185 185 /* We MUST have more than 16 bytes, or the stuff below will go … … 219 219 220 220 NTSTATUS hash_password_check(TALLOC_CTX *mem_ctx, 221 221 bool lanman_auth, 222 222 const struct samr_Password *client_lanman, 223 223 const struct samr_Password *client_nt, … … 282 282 283 283 NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx, 284 285 284 bool lanman_auth, 285 bool ntlm_auth, 286 286 uint32_t logon_parameters, 287 287 const DATA_BLOB *challenge, … … 319 319 username)); 320 320 mdfour(client_nt.hash, nt_response->data, nt_response->length); 321 321 322 322 if (lm_response->length && 323 323 (convert_string_talloc(mem_ctx, CH_DOS, CH_UNIX, … … 344 344 (unsigned long)nt_response->length, username)); 345 345 } 346 346 347 347 if (nt_response->length > 24 && stored_nt) { 348 348 /* We have the NT MD4 hash challenge available - see if we can … … 362 362 return NT_STATUS_OK; 363 363 } 364 364 365 365 DEBUG(4,("ntlm_password_check: Checking NTLMv2 password with uppercased version of domain [%s]\n", client_domain)); 366 366 if (smb_pwd_check_ntlmv2(mem_ctx, … … 376 376 return NT_STATUS_OK; 377 377 } 378 378 379 379 DEBUG(4,("ntlm_password_check: Checking NTLMv2 password without a domain\n")); 380 380 if (smb_pwd_check_ntlmv2(mem_ctx, … … 404 404 /* The LM session key for this response is not very secure, 405 405 so use it only if we otherwise allow LM authentication */ 406 406 407 407 if (lanman_auth && stored_lanman) { 408 408 *lm_sess_key = data_blob_talloc(mem_ctx, stored_lanman->hash, MIN(8, user_sess_key->length)); … … 417 417 DEBUG(2,("ntlm_password_check: NTLMv1 passwords NOT PERMITTED for user %s\n", 418 418 username)); 419 /* no return, bec ouse we might pick up LMv2 in the LM field */420 } 421 } 422 419 /* no return, because we might pick up LMv2 in the LM field */ 420 } 421 } 422 423 423 if (lm_response->length == 0) { 424 424 DEBUG(3,("ntlm_password_check: NEITHER LanMan nor NT password supplied for user %s\n", … … 426 426 return NT_STATUS_WRONG_PASSWORD; 427 427 } 428 428 429 429 if (lm_response->length < 24) { 430 430 DEBUG(2,("ntlm_password_check: invalid LanMan password length (%lu) for user %s\n", … … 432 432 return NT_STATUS_WRONG_PASSWORD; 433 433 } 434 434 435 435 if (!lanman_auth) { 436 436 DEBUG(3,("ntlm_password_check: Lanman passwords NOT PERMITTED for user %s\n", … … 462 462 } 463 463 } 464 464 465 465 if (!stored_nt) { 466 466 DEBUG(4,("ntlm_password_check: LM password check failed for user, no NT password %s\n",username)); 467 467 return NT_STATUS_WRONG_PASSWORD; 468 468 } 469 469 470 470 /* This is for 'LMv2' authentication. almost NTLMv2 but limited to 24 bytes. 471 471 - related to Win9X, legacy NAS pass-though authentication … … 500 500 return NT_STATUS_OK; 501 501 } 502 502 503 503 DEBUG(4,("ntlm_password_check: Checking LMv2 password with upper-cased version of domain %s\n", client_domain)); 504 504 if (smb_pwd_check_ntlmv2(mem_ctx, … … 530 530 return NT_STATUS_OK; 531 531 } 532 532 533 533 DEBUG(4,("ntlm_password_check: Checking LMv2 password without a domain\n")); 534 534 if (smb_pwd_check_ntlmv2(mem_ctx, -
vendor/current/libcli/auth/proto.h
r587 r740 195 195 void des_crypt64(uint8_t out[8], const uint8_t in[8], const uint8_t key[8], int forw); 196 196 void des_crypt112(uint8_t out[8], const uint8_t in[8], const uint8_t key[14], int forw); 197 void des_crypt112_16(uint8_t out[16], uint8_t in[16], const uint8_t key[14], int forw);198 void sam_rid_crypt(u int_t rid, const uint8_t *in, uint8_t *out, int forw);197 void des_crypt112_16(uint8_t out[16], const uint8_t in[16], const uint8_t key[14], int forw); 198 void sam_rid_crypt(unsigned int rid, const uint8_t *in, uint8_t *out, int forw); 199 199 #undef _PRINTF_ATTRIBUTE 200 200 #define _PRINTF_ATTRIBUTE(a1, a2) -
vendor/current/libcli/auth/schannel_proto.h
r414 r740 24 24 #define _LIBCLI_AUTH_SCHANNEL_PROTO_H__ 25 25 26 struct schannel_state; 27 28 struct tdb_wrap *open_schannel_session_store(TALLOC_CTX *mem_ctx, 29 const char *private_dir); 30 26 31 NTSTATUS netsec_incoming_packet(struct schannel_state *state, 27 32 TALLOC_CTX *mem_ctx, … … 29 34 uint8_t *data, size_t length, 30 35 const DATA_BLOB *sig); 36 uint32_t netsec_outgoing_sig_size(struct schannel_state *state); 31 37 NTSTATUS netsec_outgoing_packet(struct schannel_state *state, 32 38 TALLOC_CTX *mem_ctx, -
vendor/current/libcli/auth/schannel_sign.c
r414 r740 205 205 } 206 206 207 uint32_t netsec_outgoing_sig_size(struct schannel_state *state) 208 { 209 uint32_t sig_size = 0; 210 211 netsec_offset_and_sizes(state, 212 true, 213 NULL, 214 &sig_size, 215 NULL, 216 NULL); 217 218 return sig_size; 219 } 220 207 221 NTSTATUS netsec_outgoing_packet(struct schannel_state *state, 208 222 TALLOC_CTX *mem_ctx, -
vendor/current/libcli/auth/schannel_state.h
r414 r740 1 /* 1 /* 2 2 Unix SMB/CIFS implementation. 3 3 … … 11 11 the Free Software Foundation; either version 3 of the License, or 12 12 (at your option) any later version. 13 13 14 14 This program is distributed in the hope that it will be useful, 15 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 17 GNU General Public License for more details. 18 18 19 19 You should have received a copy of the GNU General Public License 20 20 along with this program. If not, see <http://www.gnu.org/licenses/>. 21 21 */ 22 22 23 struct ldb_context; 24 struct tdb_context; 25 #include "libcli/auth/schannel_state_proto.h" 23 #ifndef _LIBCLI_AUTH_SCHANNEL_STATE_H__ 24 #define _LIBCLI_AUTH_SCHANNEL_STATE_H__ 25 26 NTSTATUS schannel_get_creds_state(TALLOC_CTX *mem_ctx, 27 const char *db_priv_dir, 28 const char *computer_name, 29 struct netlogon_creds_CredentialState **creds); 30 31 NTSTATUS schannel_save_creds_state(TALLOC_CTX *mem_ctx, 32 const char *db_priv_dir, 33 struct netlogon_creds_CredentialState *creds); 34 35 NTSTATUS schannel_check_creds_state(TALLOC_CTX *mem_ctx, 36 const char *db_priv_dir, 37 const char *computer_name, 38 struct netr_Authenticator *received_authenticator, 39 struct netr_Authenticator *return_authenticator, 40 struct netlogon_creds_CredentialState **creds_out); 41 42 #endif -
vendor/current/libcli/auth/schannel_state_tdb.c
r414 r740 23 23 24 24 #include "includes.h" 25 #include "../libcli/auth/libcli_auth.h" 26 #include "../libcli/auth/schannel_state.h" 25 #include "system/filesys.h" 26 #include <tdb.h> 27 #include "../lib/util/util_tdb.h" 28 #include "../libcli/auth/schannel.h" 27 29 #include "../librpc/gen_ndr/ndr_schannel.h" 30 #include "lib/util/tdb_wrap.h" 31 32 #define SECRETS_SCHANNEL_STATE "SECRETS/SCHANNEL" 33 34 /****************************************************************************** 35 Open or create the schannel session store tdb. Non-static so it can 36 be called from parent processes to corectly handle TDB_CLEAR_IF_FIRST 37 *******************************************************************************/ 38 39 struct tdb_wrap *open_schannel_session_store(TALLOC_CTX *mem_ctx, 40 const char *private_dir) 41 { 42 struct tdb_wrap *tdb_sc = NULL; 43 char *fname = talloc_asprintf(mem_ctx, "%s/schannel_store.tdb", private_dir); 44 45 if (!fname) { 46 return NULL; 47 } 48 49 tdb_sc = tdb_wrap_open(mem_ctx, fname, 0, TDB_CLEAR_IF_FIRST|TDB_NOSYNC, O_RDWR|O_CREAT, 0600); 50 51 if (!tdb_sc) { 52 DEBUG(0,("open_schannel_session_store: Failed to open %s - %s\n", 53 fname, strerror(errno))); 54 TALLOC_FREE(fname); 55 return NULL; 56 } 57 58 TALLOC_FREE(fname); 59 60 return tdb_sc; 61 } 28 62 29 63 /******************************************************************** 30 64 ********************************************************************/ 31 65 32 NTSTATUS schannel_store_session_key_tdb(struct tdb_context *tdb, 66 static 67 NTSTATUS schannel_store_session_key_tdb(struct tdb_wrap *tdb_sc, 33 68 TALLOC_CTX *mem_ctx, 34 69 struct netlogon_creds_CredentialState *creds) … … 39 74 int ret; 40 75 char *keystr; 41 42 keystr = talloc_asprintf_strupper_m(mem_ctx, "%s/%s", 43 SECRETS_SCHANNEL_STATE, 44 creds->computer_name); 76 char *name_upper; 77 78 name_upper = strupper_talloc(mem_ctx, creds->computer_name); 79 if (!name_upper) { 80 return NT_STATUS_NO_MEMORY; 81 } 82 83 keystr = talloc_asprintf(mem_ctx, "%s/%s", 84 SECRETS_SCHANNEL_STATE, name_upper); 85 TALLOC_FREE(name_upper); 45 86 if (!keystr) { 46 87 return NT_STATUS_NO_MEMORY; 47 88 } 48 89 49 ndr_err = ndr_push_struct_blob(&blob, mem_ctx, NULL,creds,90 ndr_err = ndr_push_struct_blob(&blob, mem_ctx, creds, 50 91 (ndr_push_flags_fn_t)ndr_push_netlogon_creds_CredentialState); 51 92 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { … … 57 98 value.dsize = blob.length; 58 99 59 ret = tdb_store_bystring(tdb , keystr, value, TDB_REPLACE);100 ret = tdb_store_bystring(tdb_sc->tdb, keystr, value, TDB_REPLACE); 60 101 if (ret != TDB_SUCCESS) { 61 102 DEBUG(0,("Unable to add %s to session key db - %s\n", 62 keystr, tdb_errorstr(tdb )));103 keystr, tdb_errorstr(tdb_sc->tdb))); 63 104 talloc_free(keystr); 64 105 return NT_STATUS_INTERNAL_DB_CORRUPTION; … … 80 121 ********************************************************************/ 81 122 82 NTSTATUS schannel_fetch_session_key_tdb(struct tdb_context *tdb, 123 static 124 NTSTATUS schannel_fetch_session_key_tdb(struct tdb_wrap *tdb_sc, 83 125 TALLOC_CTX *mem_ctx, 84 126 const char *computer_name, … … 91 133 struct netlogon_creds_CredentialState *creds = NULL; 92 134 char *keystr = NULL; 135 char *name_upper; 93 136 94 137 *pcreds = NULL; 95 138 96 keystr = talloc_asprintf_strupper_m(mem_ctx, "%s/%s", 97 SECRETS_SCHANNEL_STATE, 98 computer_name); 139 name_upper = strupper_talloc(mem_ctx, computer_name); 140 if (!name_upper) { 141 return NT_STATUS_NO_MEMORY; 142 } 143 144 keystr = talloc_asprintf(mem_ctx, "%s/%s", 145 SECRETS_SCHANNEL_STATE, name_upper); 146 TALLOC_FREE(name_upper); 99 147 if (!keystr) { 100 status = NT_STATUS_NO_MEMORY; 101 goto done; 102 } 103 104 value = tdb_fetch_bystring(tdb, keystr); 148 return NT_STATUS_NO_MEMORY; 149 } 150 151 value = tdb_fetch_bystring(tdb_sc->tdb, keystr); 105 152 if (!value.dptr) { 106 DEBUG( 0,("schannel_fetch_session_key_tdb: Failed to find entry with key %s\n",153 DEBUG(10,("schannel_fetch_session_key_tdb: Failed to find entry with key %s\n", 107 154 keystr )); 108 155 status = NT_STATUS_OBJECT_NAME_NOT_FOUND; … … 118 165 blob = data_blob_const(value.dptr, value.dsize); 119 166 120 ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, NULL, creds,167 ndr_err = ndr_pull_struct_blob(&blob, creds, creds, 121 168 (ndr_pull_flags_fn_t)ndr_pull_netlogon_creds_CredentialState); 122 169 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { … … 137 184 138 185 talloc_free(keystr); 186 SAFE_FREE(value.dptr); 139 187 140 188 if (!NT_STATUS_IS_OK(status)) { … … 148 196 } 149 197 198 /****************************************************************************** 199 Wrapper around schannel_fetch_session_key_tdb() 200 Note we must be root here. 201 *******************************************************************************/ 202 203 NTSTATUS schannel_get_creds_state(TALLOC_CTX *mem_ctx, 204 const char *db_priv_dir, 205 const char *computer_name, 206 struct netlogon_creds_CredentialState **_creds) 207 { 208 TALLOC_CTX *tmpctx; 209 struct tdb_wrap *tdb_sc; 210 struct netlogon_creds_CredentialState *creds; 211 NTSTATUS status; 212 213 tmpctx = talloc_named(mem_ctx, 0, "schannel_get_creds_state"); 214 if (!tmpctx) { 215 return NT_STATUS_NO_MEMORY; 216 } 217 218 tdb_sc = open_schannel_session_store(tmpctx, db_priv_dir); 219 if (!tdb_sc) { 220 return NT_STATUS_ACCESS_DENIED; 221 } 222 223 status = schannel_fetch_session_key_tdb(tdb_sc, tmpctx, 224 computer_name, &creds); 225 if (NT_STATUS_IS_OK(status)) { 226 *_creds = talloc_steal(mem_ctx, creds); 227 if (!*_creds) { 228 status = NT_STATUS_NO_MEMORY; 229 } 230 } 231 232 talloc_free(tmpctx); 233 return status; 234 } 235 236 /****************************************************************************** 237 Wrapper around schannel_store_session_key_tdb() 238 Note we must be root here. 239 *******************************************************************************/ 240 241 NTSTATUS schannel_save_creds_state(TALLOC_CTX *mem_ctx, 242 const char *db_priv_dir, 243 struct netlogon_creds_CredentialState *creds) 244 { 245 TALLOC_CTX *tmpctx; 246 struct tdb_wrap *tdb_sc; 247 NTSTATUS status; 248 249 tmpctx = talloc_named(mem_ctx, 0, "schannel_save_creds_state"); 250 if (!tmpctx) { 251 return NT_STATUS_NO_MEMORY; 252 } 253 254 tdb_sc = open_schannel_session_store(tmpctx, db_priv_dir); 255 if (!tdb_sc) { 256 return NT_STATUS_ACCESS_DENIED; 257 } 258 259 status = schannel_store_session_key_tdb(tdb_sc, tmpctx, creds); 260 261 talloc_free(tmpctx); 262 return status; 263 } 264 150 265 /******************************************************************** 151 152 Validate an incoming authenticator against the credentials for the remote 153 machine. 154 155 The credentials are (re)read and from the schannel database, and 156 written back after the caclulations are performed. 157 158 The creds_out parameter (if not NULL) returns the credentials, if 159 the caller needs some of that information. 160 266 Validate an incoming authenticator against the credentials for the 267 remote machine stored in the schannel database. 268 269 The credentials are (re)read and from the schannel database, and 270 written back after the caclulations are performed. 271 272 If the creds_out parameter is not NULL returns the credentials. 161 273 ********************************************************************/ 162 274 163 NTSTATUS schannel_c reds_server_step_check_tdb(struct tdb_context *tdb,164 TALLOC_CTX *mem_ctx,165 166 bool schannel_required_for_call,167 bool schannel_in_use,168 struct netr_Authenticator *received_authenticator,169 struct netr_Authenticator *return_authenticator, 170 struct netlogon_creds_CredentialState **creds_out)171 { 275 NTSTATUS schannel_check_creds_state(TALLOC_CTX *mem_ctx, 276 const char *db_priv_dir, 277 const char *computer_name, 278 struct netr_Authenticator *received_authenticator, 279 struct netr_Authenticator *return_authenticator, 280 struct netlogon_creds_CredentialState **creds_out) 281 { 282 TALLOC_CTX *tmpctx; 283 struct tdb_wrap *tdb_sc; 172 284 struct netlogon_creds_CredentialState *creds; 173 285 NTSTATUS status; 174 286 int ret; 175 287 176 ret = tdb_transaction_start(tdb); 288 tmpctx = talloc_named(mem_ctx, 0, "schannel_check_creds_state"); 289 if (!tmpctx) { 290 return NT_STATUS_NO_MEMORY; 291 } 292 293 tdb_sc = open_schannel_session_store(tmpctx, db_priv_dir); 294 if (!tdb_sc) { 295 status = NT_STATUS_ACCESS_DENIED; 296 goto done; 297 } 298 299 ret = tdb_transaction_start(tdb_sc->tdb); 177 300 if (ret != 0) { 178 return NT_STATUS_INTERNAL_DB_CORRUPTION; 301 status = NT_STATUS_INTERNAL_DB_CORRUPTION; 302 goto done; 179 303 } 180 304 … … 183 307 * update the structure */ 184 308 185 status = schannel_fetch_session_key_tdb(tdb, mem_ctx, computer_name, 186 &creds); 187 188 /* If we are flaged that schannel is required for a call, and 189 * it is not in use, then make this an error */ 190 191 /* It would be good to make this mandatory once schannel is 192 * negotiated, but this is not what windows does */ 193 if (schannel_required_for_call && !schannel_in_use) { 194 DEBUG(0,("schannel_creds_server_step_check_tdb: " 195 "client %s not using schannel for netlogon, despite negotiating it\n", 196 creds->computer_name )); 197 tdb_transaction_cancel(tdb); 198 return NT_STATUS_ACCESS_DENIED; 199 } 200 201 if (NT_STATUS_IS_OK(status)) { 202 status = netlogon_creds_server_step_check(creds, 203 received_authenticator, 204 return_authenticator); 205 } 206 207 if (NT_STATUS_IS_OK(status)) { 208 status = schannel_store_session_key_tdb(tdb, mem_ctx, creds); 209 } 210 211 if (NT_STATUS_IS_OK(status)) { 212 tdb_transaction_commit(tdb); 213 if (creds_out) { 214 *creds_out = creds; 215 talloc_steal(mem_ctx, creds); 309 status = schannel_fetch_session_key_tdb(tdb_sc, tmpctx, 310 computer_name, &creds); 311 if (!NT_STATUS_IS_OK(status)) { 312 tdb_transaction_cancel(tdb_sc->tdb); 313 goto done; 314 } 315 316 status = netlogon_creds_server_step_check(creds, 317 received_authenticator, 318 return_authenticator); 319 if (!NT_STATUS_IS_OK(status)) { 320 tdb_transaction_cancel(tdb_sc->tdb); 321 goto done; 322 } 323 324 status = schannel_store_session_key_tdb(tdb_sc, tmpctx, creds); 325 if (!NT_STATUS_IS_OK(status)) { 326 tdb_transaction_cancel(tdb_sc->tdb); 327 goto done; 328 } 329 330 tdb_transaction_commit(tdb_sc->tdb); 331 332 if (creds_out) { 333 *creds_out = talloc_steal(mem_ctx, creds); 334 if (!*creds_out) { 335 status = NT_STATUS_NO_MEMORY; 336 goto done; 216 337 } 217 } else { 218 tdb_transaction_cancel(tdb); 219 } 220 338 } 339 340 status = NT_STATUS_OK; 341 342 done: 343 talloc_free(tmpctx); 221 344 return status; 222 345 } 346 -
vendor/current/libcli/auth/smbdes.c
r414 r740 359 359 360 360 /* des encryption of a 16 byte lump of data with a 112 bit key */ 361 void des_crypt112_16(uint8_t out[16], uint8_t in[16], const uint8_t key[14], int forw)361 void des_crypt112_16(uint8_t out[16], const uint8_t in[16], const uint8_t key[14], int forw) 362 362 { 363 363 des_crypt56(out, in, key, forw); … … 368 368 same method used to store passwords in the NT registry. The DES key 369 369 used is based on the RID of the user. */ 370 void sam_rid_crypt(u int_t rid, const uint8_t *in, uint8_t *out, int forw)370 void sam_rid_crypt(unsigned int rid, const uint8_t *in, uint8_t *out, int forw) 371 371 { 372 372 uint8_t s[14]; -
vendor/current/libcli/auth/smbencrypt.c
r414 r740 364 364 DATA_BLOB names_blob = data_blob_talloc(mem_ctx, NULL, 0); 365 365 366 msrpc_gen(mem_ctx, &names_blob, 366 /* Deliberately ignore return here.. */ 367 (void)msrpc_gen(mem_ctx, &names_blob, 367 368 "aaa", 368 369 MsvAvNbDomainName, domain, … … 387 388 /* See http://www.ubiqx.org/cifs/SMB.html#SMB.8.5 */ 388 389 389 msrpc_gen(mem_ctx, &response, "ddbbdb", 390 /* Deliberately ignore return here.. */ 391 (void)msrpc_gen(mem_ctx, &response, "ddbbdb", 390 392 0x00000101, /* Header */ 391 393 0, /* 'Reserved' */ … … 530 532 { 531 533 uint8_t new_pw[512]; 532 s ize_t new_pw_len;534 ssize_t new_pw_len; 533 535 534 536 /* the incoming buffer can be any alignment. */ … … 538 540 password, 539 541 sizeof(new_pw), string_flags); 542 if (new_pw_len == -1) { 543 return false; 544 } 540 545 541 546 memcpy(&buffer[512 - new_pw_len], new_pw, new_pw_len); -
vendor/current/libcli/auth/spnego.h
r414 r740 26 26 #define OID_KERBEROS5 "1.2.840.113554.1.2.2" 27 27 28 #define ADS_IGNORE_PRINCIPAL "not_defined_in_RFC4178@please_ignore" 29 28 30 #define SPNEGO_DELEG_FLAG 0x01 29 31 #define SPNEGO_MUTUAL_FLAG 0x02 … … 33 35 #define SPNEGO_CONF_FLAG 0x20 34 36 #define SPNEGO_INTEG_FLAG 0x40 37 38 #define TOK_ID_KRB_AP_REQ ((const uint8_t *)"\x01\x00") 39 #define TOK_ID_KRB_AP_REP ((const uint8_t *)"\x02\x00") 40 #define TOK_ID_KRB_ERROR ((const uint8_t *)"\x03\x00") 41 #define TOK_ID_GSS_GETMIC ((const uint8_t *)"\x01\x01") 42 #define TOK_ID_GSS_WRAP ((const uint8_t *)"\x02\x01") 35 43 36 44 enum spnego_negResult { -
vendor/current/libcli/auth/spnego_parse.c
r478 r740 50 50 for (i = 0; !asn1->has_error && 51 51 0 < asn1_tag_remaining(asn1); i++) { 52 char *oid; 52 53 token->mechTypes = talloc_realloc(NULL, 53 54 token->mechTypes, 54 55 const char *, i+2); 55 asn1_read_OID(asn1, token->mechTypes, token->mechTypes + i); 56 asn1_read_OID(asn1, token->mechTypes, &oid); 57 token->mechTypes[i] = oid; 56 58 } 57 59 token->mechTypes[i] = NULL; … … 185 187 while (!asn1->has_error && 0 < asn1_tag_remaining(asn1)) { 186 188 uint8_t context; 189 char *oid; 187 190 if (!asn1_peek_uint8(asn1, &context)) { 188 191 asn1->has_error = true; … … 200 203 case ASN1_CONTEXT(1): 201 204 asn1_start_tag(asn1, ASN1_CONTEXT(1)); 202 asn1_read_OID(asn1, mem_ctx, &token->supportedMech); 205 asn1_read_OID(asn1, mem_ctx, &oid); 206 token->supportedMech = oid; 203 207 asn1_end_tag(asn1); 204 208 break; … … 381 385 struct asn1_data *asn1 = asn1_init(mem_ctx); 382 386 387 if (asn1 == NULL) { 388 return false; 389 } 390 383 391 /* Write mechTypes */ 384 392 if (mech_types && *mech_types) { -
vendor/current/libcli/cldap/cldap.c
r414 r740 168 168 } 169 169 170 static voidcldap_socket_recv_dgram(struct cldap_socket *c,170 static bool cldap_socket_recv_dgram(struct cldap_socket *c, 171 171 struct cldap_incoming *in); 172 172 … … 177 177 struct cldap_incoming *in = NULL; 178 178 ssize_t ret; 179 bool setup_done; 179 180 180 181 c->recv_subreq = NULL; … … 200 201 201 202 /* this function should free or steal 'in' */ 202 cldap_socket_recv_dgram(c, in);203 setup_done = cldap_socket_recv_dgram(c, in); 203 204 in = NULL; 204 205 205 if (! cldap_recvfrom_setup(c)) {206 if (!setup_done && !cldap_recvfrom_setup(c)) { 206 207 goto nomem; 207 208 } … … 219 220 handle recv events on a cldap socket 220 221 */ 221 static voidcldap_socket_recv_dgram(struct cldap_socket *c,222 static bool cldap_socket_recv_dgram(struct cldap_socket *c, 222 223 struct cldap_incoming *in) 223 224 { … … 263 264 /* this function should free or steal 'in' */ 264 265 c->incoming.handler(c, c->incoming.private_data, in); 265 return ;266 return false; 266 267 } 267 268 … … 271 272 search->response.asn1->ofs = 0; 272 273 274 DLIST_REMOVE(c->searches.list, search); 275 276 if (!cldap_recvfrom_setup(c)) { 277 goto nomem; 278 } 279 273 280 tevent_req_done(search->req); 274 goto done; 281 talloc_free(in); 282 return true; 275 283 276 284 nomem: … … 290 298 done: 291 299 talloc_free(in); 300 return false; 292 301 } 293 302 … … 321 330 322 331 if (!local_addr) { 323 ret = tsocket_address_inet_from_strings(c, "ip", 332 /* we use ipv4 here instead of ip, as otherwise we end 333 up with a PF_INET6 socket, and sendto() for ipv4 334 addresses will fail. That breaks cldap name 335 resolution for winbind to IPv4 hosts. */ 336 ret = tsocket_address_inet_from_strings(c, "ipv4", 324 337 NULL, 0, 325 338 &any); … … 947 960 */ 948 961 NTSTATUS cldap_netlogon_recv(struct tevent_req *req, 949 struct smb_iconv_convenience *iconv_convenience,950 962 TALLOC_CTX *mem_ctx, 951 963 struct cldap_netlogon *io) … … 975 987 976 988 status = pull_netlogon_samlogon_response(data, mem_ctx, 977 iconv_convenience,978 989 &io->out.netlogon); 979 990 if (!NT_STATUS_IS_OK(status)) { … … 995 1006 */ 996 1007 NTSTATUS cldap_netlogon(struct cldap_socket *cldap, 997 struct smb_iconv_convenience *iconv_convenience,998 1008 TALLOC_CTX *mem_ctx, 999 1009 struct cldap_netlogon *io) … … 1018 1028 } 1019 1029 1020 status = cldap_netlogon_recv(req, iconv_convenience,mem_ctx, io);1030 status = cldap_netlogon_recv(req, mem_ctx, io); 1021 1031 talloc_free(req); 1022 1032 … … 1082 1092 */ 1083 1093 NTSTATUS cldap_netlogon_reply(struct cldap_socket *cldap, 1084 struct smb_iconv_convenience *iconv_convenience,1085 1094 uint32_t message_id, 1086 1095 struct tsocket_address *dest, … … 1096 1105 1097 1106 status = push_netlogon_samlogon_response(&blob, tmp_ctx, 1098 iconv_convenience,1099 1107 netlogon); 1100 1108 if (!NT_STATUS_IS_OK(status)) { -
vendor/current/libcli/cldap/cldap.h
r414 r740 20 20 */ 21 21 22 #include "../libcli/netlogon .h"22 #include "../libcli/netlogon/netlogon.h" 23 23 24 24 struct ldap_message; … … 117 117 const struct cldap_netlogon *io); 118 118 NTSTATUS cldap_netlogon_recv(struct tevent_req *req, 119 struct smb_iconv_convenience *iconv_convenience,120 119 TALLOC_CTX *mem_ctx, 121 120 struct cldap_netlogon *io); 122 121 NTSTATUS cldap_netlogon(struct cldap_socket *cldap, 123 struct smb_iconv_convenience *iconv_convenience,124 122 TALLOC_CTX *mem_ctx, 125 123 struct cldap_netlogon *io); 126 124 127 125 NTSTATUS cldap_netlogon_reply(struct cldap_socket *cldap, 128 struct smb_iconv_convenience *iconv_convenience,129 126 uint32_t message_id, 130 127 struct tsocket_address *dst, -
vendor/current/libcli/drsuapi/repl_decrypt.c
r414 r740 147 147 148 148 switch (attr->attid) { 149 case DRSUAPI_ATT RIBUTE_dBCSPwd:150 case DRSUAPI_ATT RIBUTE_unicodePwd:151 case DRSUAPI_ATT RIBUTE_ntPwdHistory:152 case DRSUAPI_ATT RIBUTE_lmPwdHistory:149 case DRSUAPI_ATTID_dBCSPwd: 150 case DRSUAPI_ATTID_unicodePwd: 151 case DRSUAPI_ATTID_ntPwdHistory: 152 case DRSUAPI_ATTID_lmPwdHistory: 153 153 rid_crypt = true; 154 154 break; 155 case DRSUAPI_ATT RIBUTE_supplementalCredentials:156 case DRSUAPI_ATT RIBUTE_priorValue:157 case DRSUAPI_ATT RIBUTE_currentValue:158 case DRSUAPI_ATT RIBUTE_trustAuthOutgoing:159 case DRSUAPI_ATT RIBUTE_trustAuthIncoming:160 case DRSUAPI_ATT RIBUTE_initialAuthOutgoing:161 case DRSUAPI_ATT RIBUTE_initialAuthIncoming:155 case DRSUAPI_ATTID_supplementalCredentials: 156 case DRSUAPI_ATTID_priorValue: 157 case DRSUAPI_ATTID_currentValue: 158 case DRSUAPI_ATTID_trustAuthOutgoing: 159 case DRSUAPI_ATTID_trustAuthIncoming: 160 case DRSUAPI_ATTID_initialAuthOutgoing: 161 case DRSUAPI_ATTID_initialAuthIncoming: 162 162 break; 163 163 default: … … 309 309 310 310 switch (attr->attid) { 311 case DRSUAPI_ATT RIBUTE_dBCSPwd:312 case DRSUAPI_ATT RIBUTE_unicodePwd:313 case DRSUAPI_ATT RIBUTE_ntPwdHistory:314 case DRSUAPI_ATT RIBUTE_lmPwdHistory:311 case DRSUAPI_ATTID_dBCSPwd: 312 case DRSUAPI_ATTID_unicodePwd: 313 case DRSUAPI_ATTID_ntPwdHistory: 314 case DRSUAPI_ATTID_lmPwdHistory: 315 315 rid_crypt = true; 316 316 break; 317 case DRSUAPI_ATT RIBUTE_supplementalCredentials:318 case DRSUAPI_ATT RIBUTE_priorValue:319 case DRSUAPI_ATT RIBUTE_currentValue:320 case DRSUAPI_ATT RIBUTE_trustAuthOutgoing:321 case DRSUAPI_ATT RIBUTE_trustAuthIncoming:322 case DRSUAPI_ATT RIBUTE_initialAuthOutgoing:323 case DRSUAPI_ATT RIBUTE_initialAuthIncoming:317 case DRSUAPI_ATTID_supplementalCredentials: 318 case DRSUAPI_ATTID_priorValue: 319 case DRSUAPI_ATTID_currentValue: 320 case DRSUAPI_ATTID_trustAuthOutgoing: 321 case DRSUAPI_ATTID_trustAuthIncoming: 322 case DRSUAPI_ATTID_initialAuthOutgoing: 323 case DRSUAPI_ATTID_initialAuthIncoming: 324 324 break; 325 325 default: -
vendor/current/libcli/ldap/ldap_message.c
r414 r740 168 168 169 169 for (i = 0; handlers[i].oid != NULL; i++) { 170 if (!ctrl->oid) { 171 /* not encoding this control, the OID has been 172 * set to NULL indicating it isn't really 173 * here */ 174 return true; 175 } 170 176 if (strcmp(handlers[i].oid, ctrl->oid) == 0) { 171 177 if (!handlers[i].encode) { … … 435 441 case LDAP_TAG_UnbindRequest: { 436 442 /* struct ldap_UnbindRequest *r = &msg->r.UnbindRequest; */ 443 asn1_push_tag(data, ASN1_APPLICATION_SIMPLE(msg->type)); 444 asn1_pop_tag(data); 437 445 break; 438 446 } … … 669 677 control_handlers, 670 678 msg->controls[i])) { 679 DEBUG(1,("Unable to encode control %s\n", 680 msg->controls[i]->oid)); 671 681 return false; 672 682 } … … 1608 1618 NTSTATUS ldap_full_packet(void *private_data, DATA_BLOB blob, size_t *packet_size) 1609 1619 { 1610 return asn1_full_tag(blob, ASN1_SEQUENCE(0), packet_size); 1611 } 1620 if (blob.length < 6) { 1621 /* 1622 * We need at least 6 bytes to workout the length 1623 * of the pdu. 1624 */ 1625 return STATUS_MORE_ENTRIES; 1626 } 1627 return asn1_peek_full_tag(blob, ASN1_SEQUENCE(0), packet_size); 1628 } -
vendor/current/libcli/ldap/ldap_message.h
r414 r740 23 23 24 24 #include "../libcli/ldap/ldap_errors.h" 25 #include "lib/ldb/include/ldb.h" 25 #if _SAMBA_BUILD_ == 3 26 #include "lib/ldb_compat.h" 27 #else 28 #include <ldb.h> 29 #endif 26 30 27 31 enum ldap_request_tag { -
vendor/current/libcli/ldap/ldap_ndr.c
r414 r740 22 22 23 23 #include "includes.h" 24 #include "lib/ldb/include/ldb.h" 24 #if _SAMBA_BUILD_ == 3 25 #include "lib/ldb_compat.h" 26 #else 27 #include <ldb.h> 28 #endif 25 29 #include "librpc/gen_ndr/ndr_security.h" 26 30 #include "librpc/gen_ndr/ndr_misc.h" … … 48 52 enum ndr_err_code ndr_err; 49 53 char *ret; 50 ndr_err = ndr_push_struct_blob(&blob, mem_ctx, NULL,sid,54 ndr_err = ndr_push_struct_blob(&blob, mem_ctx, sid, 51 55 (ndr_push_flags_fn_t)ndr_push_dom_sid); 52 56 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { … … 62 66 encode a NDR GUID as a ldap filter element 63 67 */ 64 char *ldap_encode_ndr_GUID(TALLOC_CTX *mem_ctx, struct GUID *guid)68 char *ldap_encode_ndr_GUID(TALLOC_CTX *mem_ctx, const struct GUID *guid) 65 69 { 66 70 DATA_BLOB blob; 67 enum ndr_err_code ndr_err;71 NTSTATUS status; 68 72 char *ret; 69 ndr_err = ndr_push_struct_blob(&blob, mem_ctx, NULL, guid, 70 (ndr_push_flags_fn_t)ndr_push_GUID); 71 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { 73 status = GUID_to_ndr_blob(guid, mem_ctx, &blob); 74 if (!NT_STATUS_IS_OK(status)) { 72 75 return NULL; 73 76 } … … 87 90 blob.data = val.data; 88 91 blob.length = val.length; 89 ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, NULL,guid,92 ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, guid, 90 93 (ndr_pull_flags_fn_t)ndr_pull_GUID); 91 94 talloc_free(val.data); -
vendor/current/libcli/ldap/ldap_ndr.h
r414 r740 1 /* 2 Unix SMB/CIFS mplementation. 3 4 wrap/unwrap NDR encoded elements for ldap calls 5 6 Copyright (C) Andrew Tridgell 2005 7 8 This program is free software; you can redistribute it and/or modify 9 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation; either version 3 of the License, or 11 (at your option) any later version. 12 13 This program is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program. If not, see <http://www.gnu.org/licenses/>. 20 21 */ 22 1 23 #ifndef __LIBCLI_LDAP_LDAP_NDR_H__ 2 24 #define __LIBCLI_LDAP_LDAP_NDR_H__ … … 6 28 char *ldap_encode_ndr_uint32(TALLOC_CTX *mem_ctx, uint32_t value); 7 29 char *ldap_encode_ndr_dom_sid(TALLOC_CTX *mem_ctx, const struct dom_sid *sid); 8 char *ldap_encode_ndr_GUID(TALLOC_CTX *mem_ctx, struct GUID *guid);30 char *ldap_encode_ndr_GUID(TALLOC_CTX *mem_ctx, const struct GUID *guid); 9 31 NTSTATUS ldap_decode_ndr_GUID(TALLOC_CTX *mem_ctx, struct ldb_val val, struct GUID *guid); 10 32 -
vendor/current/libcli/named_pipe_auth/npa_tstream.c
r414 r740 25 25 #include "../librpc/gen_ndr/ndr_named_pipe_auth.h" 26 26 #include "../libcli/named_pipe_auth/npa_tstream.h" 27 #if _SAMBA_BUILD_ == 4 27 28 #include "libcli/raw/smb.h" 29 #endif 28 30 29 31 static const struct tstream_context_ops tstream_npa_ops; … … 40 42 struct { 41 43 struct tevent_context *ev; 42 struct smb_iconv_convenience *smb_iconv_c;43 44 } caller; 44 45 … … 59 60 60 61 struct tevent_req *tstream_npa_connect_send(TALLOC_CTX *mem_ctx, 61 struct tevent_context *ev, 62 struct smb_iconv_convenience *smb_iconv_c, 63 const char *directory, 64 const char *npipe, 65 const struct tsocket_address *client, 66 const char *client_name_in, 67 const struct tsocket_address *server, 68 const char *server_name, 69 const struct netr_SamInfo3 *sam_info3, 70 DATA_BLOB session_key, 71 DATA_BLOB delegated_creds) 62 struct tevent_context *ev, 63 const char *directory, 64 const char *npipe, 65 const struct tsocket_address *client, 66 const char *client_name_in, 67 const struct tsocket_address *server, 68 const char *server_name, 69 const struct auth_session_info_transport *session_info) 72 70 { 73 71 struct tevent_req *req; … … 76 74 int ret; 77 75 enum ndr_err_code ndr_err; 76 char *lower_case_npipe; 77 struct named_pipe_auth_req_info4 *info4; 78 78 79 79 req = tevent_req_create(mem_ctx, &state, … … 84 84 85 85 state->caller.ev = ev; 86 state->caller.smb_iconv_c = smb_iconv_c; 86 87 lower_case_npipe = strlower_talloc(state, npipe); 88 if (tevent_req_nomem(lower_case_npipe, req)) { 89 goto post; 90 } 87 91 88 92 state->unix_path = talloc_asprintf(state, "%s/%s", 89 93 directory, 90 npipe); 94 lower_case_npipe); 95 talloc_free(lower_case_npipe); 91 96 if (tevent_req_nomem(state->unix_path, req)) { 92 97 goto post; … … 110 115 111 116 ZERO_STRUCT(state->auth_req); 112 if (client) { 113 struct named_pipe_auth_req_info3 *info3; 114 115 if (!server) { 116 tevent_req_error(req, EINVAL); 117 goto post; 118 } 119 120 state->auth_req.level = 3; 121 info3 = &state->auth_req.info.info3; 122 123 info3->client_name = client_name_in; 124 info3->client_addr = tsocket_address_inet_addr_string(client, state); 125 if (!info3->client_addr) { 126 /* errno might be EINVAL */ 127 tevent_req_error(req, errno); 128 goto post; 129 } 130 info3->client_port = tsocket_address_inet_port(client); 131 if (!info3->client_name) { 132 info3->client_name = info3->client_addr; 133 } 134 135 info3->server_addr = tsocket_address_inet_addr_string(server, state); 136 if (!info3->server_addr) { 137 /* errno might be EINVAL */ 138 tevent_req_error(req, errno); 139 goto post; 140 } 141 info3->server_port = tsocket_address_inet_port(server); 142 if (!info3->server_name) { 143 info3->server_name = info3->server_addr; 144 } 145 146 info3->sam_info3 = discard_const_p(struct netr_SamInfo3, sam_info3); 147 info3->session_key_length = session_key.length; 148 info3->session_key = session_key.data; 149 info3->gssapi_delegated_creds_length = delegated_creds.length; 150 info3->gssapi_delegated_creds = delegated_creds.data; 151 152 } else if (sam_info3) { 153 state->auth_req.level = 1; 154 state->auth_req.info.info1 = *sam_info3; 155 } else { 156 state->auth_req.level = 0; 157 } 117 118 if (!server) { 119 tevent_req_error(req, EINVAL); 120 goto post; 121 } 122 123 state->auth_req.level = 4; 124 info4 = &state->auth_req.info.info4; 125 126 info4->client_name = client_name_in; 127 info4->client_addr = tsocket_address_inet_addr_string(client, state); 128 if (!info4->client_addr) { 129 /* errno might be EINVAL */ 130 tevent_req_error(req, errno); 131 goto post; 132 } 133 info4->client_port = tsocket_address_inet_port(client); 134 if (!info4->client_name) { 135 info4->client_name = info4->client_addr; 136 } 137 138 info4->server_addr = tsocket_address_inet_addr_string(server, state); 139 if (!info4->server_addr) { 140 /* errno might be EINVAL */ 141 tevent_req_error(req, errno); 142 goto post; 143 } 144 info4->server_port = tsocket_address_inet_port(server); 145 if (!info4->server_name) { 146 info4->server_name = info4->server_addr; 147 } 148 149 info4->session_info = discard_const_p(struct auth_session_info_transport, session_info); 158 150 159 151 if (DEBUGLVL(10)) { … … 162 154 163 155 ndr_err = ndr_push_struct_blob(&state->auth_req_blob, 164 state, smb_iconv_c,&state->auth_req,156 state, &state->auth_req, 165 157 (ndr_push_flags_fn_t)ndr_push_named_pipe_auth_req); 166 158 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { … … 169 161 } 170 162 171 state->auth_req_iov.iov_base = state->auth_req_blob.data;163 state->auth_req_iov.iov_base = (char *) state->auth_req_blob.data; 172 164 state->auth_req_iov.iov_len = state->auth_req_blob.length; 173 165 … … 310 302 return -1; 311 303 } 312 vector[0].iov_base = state->auth_rep_blob.data + ofs;304 vector[0].iov_base = (char *) (state->auth_rep_blob.data + ofs); 313 305 vector[0].iov_len = state->auth_rep_blob.length - ofs; 314 306 count = 1; … … 344 336 ndr_err = ndr_pull_struct_blob( 345 337 &state->auth_rep_blob, state, 346 state->caller.smb_iconv_c,&state->auth_rep,338 &state->auth_rep, 347 339 (ndr_pull_flags_fn_t)ndr_pull_named_pipe_auth_rep); 348 340 … … 417 409 location); 418 410 if (!stream) { 411 *perrno = ENOMEM; 412 tevent_req_received(req); 419 413 return -1; 420 414 } … … 423 417 npas->unix_stream = talloc_move(stream, &state->unix_stream); 424 418 switch (state->auth_rep.level) { 425 case 0: 426 case 1: 427 npas->file_type = FILE_TYPE_BYTE_MODE_PIPE; 428 device_state = 0x00ff; 429 allocation_size = 2048; 430 break; 431 case 2: 432 npas->file_type = state->auth_rep.info.info2.file_type; 433 device_state = state->auth_rep.info.info2.device_state; 434 allocation_size = state->auth_rep.info.info2.allocation_size; 435 break; 436 case 3: 437 npas->file_type = state->auth_rep.info.info3.file_type; 438 device_state = state->auth_rep.info.info3.device_state; 439 allocation_size = state->auth_rep.info.info3.allocation_size; 419 case 4: 420 npas->file_type = state->auth_rep.info.info4.file_type; 421 device_state = state->auth_rep.info.info4.device_state; 422 allocation_size = state->auth_rep.info.info4.allocation_size; 440 423 break; 441 424 } … … 570 553 571 554 base += left; 572 state->vector[0].iov_base = base;555 state->vector[0].iov_base = (char *) base; 573 556 state->vector[0].iov_len -= left; 574 557 … … 595 578 if (left > 0) { 596 579 memmove(pbase, pbase + ofs, left); 597 npas->pending.iov_base = pbase;580 npas->pending.iov_base = (char *) pbase; 598 581 npas->pending.iov_len = left; 599 582 /* … … 603 586 pbase = talloc_realloc(npas, pbase, uint8_t, left); 604 587 if (pbase) { 605 npas->pending.iov_base = pbase;588 npas->pending.iov_base = (char *) pbase; 606 589 } 607 590 pbase = NULL; … … 691 674 } 692 675 ZERO_STRUCT(state->hdr); 693 vector[0].iov_base = state->hdr;676 vector[0].iov_base = (char *) state->hdr; 694 677 vector[0].iov_len = sizeof(state->hdr); 695 678 … … 727 710 uint8_t *base; 728 711 base = (uint8_t *)state->vector[0].iov_base; 729 vector[count].iov_base = base;712 vector[count].iov_base = (char *) base; 730 713 vector[count].iov_len = left; 731 714 count++; 732 715 base += left; 733 state->vector[0].iov_base = base;716 state->vector[0].iov_base = (char *) base; 734 717 state->vector[0].iov_len -= left; 735 718 break; … … 744 727 if (left > 0) { 745 728 /* 746 * if the message i flonger than the buffers the caller729 * if the message is longer than the buffers the caller 747 730 * requested, we need to consume the rest of the message 748 731 * into the pending buffer, where the next readv can 749 732 * be served from. 750 733 */ 751 npas->pending.iov_base = talloc_array(npas, uint8_t, left);734 npas->pending.iov_base = talloc_array(npas, char, left); 752 735 if (!npas->pending.iov_base) { 753 736 return -1; … … 809 792 810 793 /* the header for message mode */ 794 bool hdr_used; 811 795 uint8_t hdr[2]; 812 796 … … 845 829 switch (npas->file_type) { 846 830 case FILE_TYPE_BYTE_MODE_PIPE: 831 state->hdr_used = false; 847 832 state->vector = vector; 848 833 state->count = count; … … 858 843 goto post; 859 844 } 860 new_vector[0].iov_base = state->hdr;845 new_vector[0].iov_base = (char *) state->hdr; 861 846 new_vector[0].iov_len = sizeof(state->hdr); 862 847 memcpy(new_vector + 1, vector, sizeof(struct iovec)*count); 863 848 849 state->hdr_used = true; 864 850 state->vector = new_vector; 865 851 state->count = count + 1; … … 910 896 tevent_req_error(req, sys_errno); 911 897 return; 898 } 899 900 /* 901 * in message mode we need to hide the length 902 * of the hdr from the caller 903 */ 904 if (state->hdr_used) { 905 ret -= sizeof(state->hdr); 912 906 } 913 907 … … 1070 1064 } 1071 1065 1066 1067 struct tstream_npa_accept_state { 1068 struct tevent_context *ev; 1069 struct tstream_context *plain; 1070 uint16_t file_type; 1071 uint16_t device_state; 1072 uint64_t alloc_size; 1073 1074 DATA_BLOB npa_blob; 1075 struct iovec out_iov; 1076 1077 /* results */ 1078 NTSTATUS accept_status; 1079 struct tsocket_address *client; 1080 char *client_name; 1081 struct tsocket_address *server; 1082 char *server_name; 1083 struct auth_session_info_transport *session_info; 1084 }; 1085 1086 static int tstream_npa_accept_next_vector(struct tstream_context *unix_stream, 1087 void *private_data, 1088 TALLOC_CTX *mem_ctx, 1089 struct iovec **_vector, 1090 size_t *_count); 1091 static void tstream_npa_accept_existing_reply(struct tevent_req *subreq); 1092 static void tstream_npa_accept_existing_done(struct tevent_req *subreq); 1093 1094 struct tevent_req *tstream_npa_accept_existing_send(TALLOC_CTX *mem_ctx, 1095 struct tevent_context *ev, 1096 struct tstream_context *plain, 1097 uint16_t file_type, 1098 uint16_t device_state, 1099 uint64_t allocation_size) 1100 { 1101 struct tstream_npa_accept_state *state; 1102 struct tevent_req *req, *subreq; 1103 1104 req = tevent_req_create(mem_ctx, &state, 1105 struct tstream_npa_accept_state); 1106 if (req == NULL) { 1107 return NULL; 1108 } 1109 1110 switch (file_type) { 1111 case FILE_TYPE_BYTE_MODE_PIPE: 1112 break; 1113 case FILE_TYPE_MESSAGE_MODE_PIPE: 1114 break; 1115 default: 1116 tevent_req_error(req, EINVAL); 1117 goto post; 1118 } 1119 1120 ZERO_STRUCTP(state); 1121 1122 state->ev = ev; 1123 state->plain = plain; 1124 state->file_type = file_type; 1125 state->device_state = device_state; 1126 state->alloc_size = allocation_size; 1127 1128 /* 1129 * The named pipe pdu's have the length as 8 byte (initial_read_size), 1130 * named_pipe_full_request provides the pdu length then. 1131 */ 1132 subreq = tstream_readv_pdu_send(state, ev, plain, 1133 tstream_npa_accept_next_vector, 1134 state); 1135 if (tevent_req_nomem(subreq, req)) { 1136 goto post; 1137 } 1138 1139 tevent_req_set_callback(subreq, 1140 tstream_npa_accept_existing_reply, req); 1141 1142 return req; 1143 1144 post: 1145 tevent_req_post(req, ev); 1146 return req; 1147 } 1148 1149 static int tstream_npa_accept_next_vector(struct tstream_context *unix_stream, 1150 void *private_data, 1151 TALLOC_CTX *mem_ctx, 1152 struct iovec **_vector, 1153 size_t *_count) 1154 { 1155 struct tstream_npa_accept_state *state = 1156 talloc_get_type_abort(private_data, 1157 struct tstream_npa_accept_state); 1158 struct iovec *vector; 1159 size_t count; 1160 off_t ofs = 0; 1161 1162 if (state->npa_blob.length == 0) { 1163 state->npa_blob = data_blob_talloc(state, NULL, 4); 1164 if (!state->npa_blob.data) { 1165 return -1; 1166 } 1167 } else if (state->npa_blob.length == 4) { 1168 uint32_t msg_len; 1169 1170 ofs = 4; 1171 1172 msg_len = RIVAL(state->npa_blob.data, 0); 1173 1174 if (msg_len > 0x00FFFFFF) { 1175 errno = EMSGSIZE; 1176 return -1; 1177 } 1178 1179 if (msg_len == 0) { 1180 errno = EMSGSIZE; 1181 return -1; 1182 } 1183 1184 msg_len += ofs; 1185 1186 state->npa_blob.data = talloc_realloc(state, 1187 state->npa_blob.data, 1188 uint8_t, msg_len); 1189 if (!state->npa_blob.data) { 1190 return -1; 1191 } 1192 state->npa_blob.length = msg_len; 1193 } else { 1194 if (memcmp(&state->npa_blob.data[4], 1195 NAMED_PIPE_AUTH_MAGIC, 4) != 0) { 1196 DEBUG(0, ("Wrong protocol\n")); 1197 #if defined(EPROTONOSUPPORT) 1198 errno = EPROTONOSUPPORT; 1199 #elif defined(EPROTO) 1200 errno = EPROTO; 1201 #else 1202 errno = EINVAL; 1203 #endif 1204 return -1; 1205 } 1206 *_vector = NULL; 1207 *_count = 0; 1208 return 0; 1209 } 1210 1211 /* we need to get a message header */ 1212 vector = talloc_array(mem_ctx, struct iovec, 1); 1213 if (!vector) { 1214 return -1; 1215 } 1216 vector[0].iov_base = (char *) (state->npa_blob.data + ofs); 1217 vector[0].iov_len = state->npa_blob.length - ofs; 1218 count = 1; 1219 1220 *_vector = vector; 1221 *_count = count; 1222 return 0; 1223 } 1224 1225 static void tstream_npa_accept_existing_reply(struct tevent_req *subreq) 1226 { 1227 struct tevent_req *req = 1228 tevent_req_callback_data(subreq, struct tevent_req); 1229 struct tstream_npa_accept_state *state = 1230 tevent_req_data(req, struct tstream_npa_accept_state); 1231 struct named_pipe_auth_req *pipe_request; 1232 struct named_pipe_auth_rep pipe_reply; 1233 struct named_pipe_auth_req_info4 i4; 1234 enum ndr_err_code ndr_err; 1235 DATA_BLOB out; 1236 int sys_errno; 1237 int ret; 1238 1239 ret = tstream_readv_pdu_recv(subreq, &sys_errno); 1240 TALLOC_FREE(subreq); 1241 if (ret == -1) { 1242 tevent_req_error(req, sys_errno); 1243 return; 1244 } 1245 1246 DEBUG(10, ("Received packet of length %lu\n", 1247 (long)state->npa_blob.length)); 1248 dump_data(11, state->npa_blob.data, state->npa_blob.length); 1249 1250 ZERO_STRUCT(pipe_reply); 1251 pipe_reply.level = 0; 1252 pipe_reply.status = NT_STATUS_INTERNAL_ERROR; 1253 /* 1254 * TODO: check it's a root (uid == 0) pipe 1255 */ 1256 1257 pipe_request = talloc(state, struct named_pipe_auth_req); 1258 if (!pipe_request) { 1259 DEBUG(0, ("Out of memory!\n")); 1260 goto reply; 1261 } 1262 1263 /* parse the passed credentials */ 1264 ndr_err = ndr_pull_struct_blob_all( 1265 &state->npa_blob, pipe_request, pipe_request, 1266 (ndr_pull_flags_fn_t)ndr_pull_named_pipe_auth_req); 1267 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { 1268 pipe_reply.status = ndr_map_error2ntstatus(ndr_err); 1269 DEBUG(2, ("Could not unmarshall named_pipe_auth_req: %s\n", 1270 nt_errstr(pipe_reply.status))); 1271 goto reply; 1272 } 1273 1274 if (DEBUGLVL(10)) { 1275 NDR_PRINT_DEBUG(named_pipe_auth_req, pipe_request); 1276 } 1277 1278 ZERO_STRUCT(i4); 1279 1280 if (pipe_request->level != 4) { 1281 DEBUG(0, ("Unknown level %u\n", pipe_request->level)); 1282 pipe_reply.level = 0; 1283 pipe_reply.status = NT_STATUS_INVALID_LEVEL; 1284 goto reply; 1285 } 1286 1287 pipe_reply.level = 4; 1288 pipe_reply.status = NT_STATUS_OK; 1289 pipe_reply.info.info4.file_type = state->file_type; 1290 pipe_reply.info.info4.device_state = state->device_state; 1291 pipe_reply.info.info4.allocation_size = state->alloc_size; 1292 1293 i4 = pipe_request->info.info4; 1294 if (i4.server_addr == NULL) { 1295 pipe_reply.status = NT_STATUS_INVALID_ADDRESS; 1296 DEBUG(2, ("Missing server address\n")); 1297 goto reply; 1298 } 1299 if (i4.client_addr == NULL) { 1300 pipe_reply.status = NT_STATUS_INVALID_ADDRESS; 1301 DEBUG(2, ("Missing client address\n")); 1302 goto reply; 1303 } 1304 1305 state->server_name = discard_const_p(char, 1306 talloc_move(state, &i4.server_name)); 1307 ret = tsocket_address_inet_from_strings(state, "ip", 1308 i4.server_addr, 1309 i4.server_port, 1310 &state->server); 1311 if (ret != 0) { 1312 DEBUG(2, ("Invalid server address[%s:%u] - %s\n", 1313 i4.server_addr, i4.server_port, 1314 strerror(errno))); 1315 pipe_reply.status = NT_STATUS_INVALID_ADDRESS; 1316 goto reply; 1317 } 1318 1319 state->client_name = discard_const_p(char, 1320 talloc_move(state, &i4.client_name)); 1321 ret = tsocket_address_inet_from_strings(state, "ip", 1322 i4.client_addr, 1323 i4.client_port, 1324 &state->client); 1325 if (ret != 0) { 1326 DEBUG(2, ("Invalid server address[%s:%u] - %s\n", 1327 i4.client_addr, i4.client_port, 1328 strerror(errno))); 1329 pipe_reply.status = NT_STATUS_INVALID_ADDRESS; 1330 goto reply; 1331 } 1332 1333 state->session_info = talloc_move(state, &i4.session_info); 1334 reply: 1335 /* create the output */ 1336 ndr_err = ndr_push_struct_blob(&out, state, &pipe_reply, 1337 (ndr_push_flags_fn_t)ndr_push_named_pipe_auth_rep); 1338 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { 1339 DEBUG(2, ("Error encoding structure: %s", 1340 ndr_map_error2string(ndr_err))); 1341 tevent_req_error(req, EIO); 1342 return; 1343 } 1344 1345 DEBUG(10, ("named_pipe_auth reply[%u]\n", (unsigned)out.length)); 1346 dump_data(11, out.data, out.length); 1347 1348 if (DEBUGLVL(10)) { 1349 NDR_PRINT_DEBUG(named_pipe_auth_rep, &pipe_reply); 1350 } 1351 1352 state->accept_status = pipe_reply.status; 1353 1354 state->out_iov.iov_base = (char *) out.data; 1355 state->out_iov.iov_len = out.length; 1356 1357 subreq = tstream_writev_send(state, state->ev, 1358 state->plain, 1359 &state->out_iov, 1); 1360 if (tevent_req_nomem(subreq, req)) { 1361 DEBUG(0, ("no memory for tstream_writev_send")); 1362 return; 1363 } 1364 1365 tevent_req_set_callback(subreq, tstream_npa_accept_existing_done, req); 1366 } 1367 1368 static void tstream_npa_accept_existing_done(struct tevent_req *subreq) 1369 { 1370 struct tevent_req *req = 1371 tevent_req_callback_data(subreq, struct tevent_req); 1372 int sys_errno; 1373 int ret; 1374 1375 ret = tstream_writev_recv(subreq, &sys_errno); 1376 TALLOC_FREE(subreq); 1377 if (ret == -1) { 1378 tevent_req_error(req, sys_errno); 1379 return; 1380 } 1381 1382 tevent_req_done(req); 1383 } 1384 1385 int _tstream_npa_accept_existing_recv(struct tevent_req *req, 1386 int *perrno, 1387 TALLOC_CTX *mem_ctx, 1388 struct tstream_context **stream, 1389 struct tsocket_address **client, 1390 char **_client_name, 1391 struct tsocket_address **server, 1392 char **server_name, 1393 struct auth_session_info_transport **session_info, 1394 const char *location) 1395 { 1396 struct tstream_npa_accept_state *state = 1397 tevent_req_data(req, struct tstream_npa_accept_state); 1398 struct tstream_npa *npas; 1399 int ret; 1400 1401 ret = tsocket_simple_int_recv(req, perrno); 1402 if (ret != 0) { 1403 DEBUG(2, ("Failed to accept named pipe conection: %s\n", 1404 strerror(*perrno))); 1405 tevent_req_received(req); 1406 return -1; 1407 } 1408 1409 if (!NT_STATUS_IS_OK(state->accept_status)) { 1410 #if defined(EPROTONOSUPPORT) 1411 *perrno = EPROTONOSUPPORT; 1412 #elif defined(EPROTO) 1413 *perrno = EPROTO; 1414 #else 1415 *perrno = EINVAL; 1416 #endif 1417 DEBUG(2, ("Failed to accept named pipe conection: %s => %s\n", 1418 nt_errstr(state->accept_status), 1419 strerror(*perrno))); 1420 tevent_req_received(req); 1421 return -1; 1422 } 1423 1424 *stream = tstream_context_create(mem_ctx, 1425 &tstream_npa_ops, 1426 &npas, 1427 struct tstream_npa, 1428 location); 1429 if (!*stream) { 1430 *perrno = ENOMEM; 1431 tevent_req_received(req); 1432 return -1; 1433 } 1434 ZERO_STRUCTP(npas); 1435 npas->unix_stream = state->plain; 1436 npas->file_type = state->file_type; 1437 1438 *client = talloc_move(mem_ctx, &state->client); 1439 *_client_name = talloc_move(mem_ctx, &state->client_name); 1440 *server = talloc_move(mem_ctx, &state->server); 1441 *server_name = talloc_move(mem_ctx, &state->server_name); 1442 *session_info = talloc_move(mem_ctx, &state->session_info); 1443 1444 tevent_req_received(req); 1445 return 0; 1446 } -
vendor/current/libcli/named_pipe_auth/npa_tstream.h
r414 r740 23 23 struct tevent_req; 24 24 struct tevent_context; 25 struct netr_SamInfo3; 25 struct auth_session_info_transport; 26 struct tsocket_address; 26 27 27 28 struct tevent_req *tstream_npa_connect_send(TALLOC_CTX *mem_ctx, 28 struct tevent_context *ev, 29 struct smb_iconv_convenience *smb_iconv_c, 30 const char *directory, 31 const char *npipe, 32 const struct tsocket_address *client, 33 const char *client_name_in, 34 const struct tsocket_address *server, 35 const char *server_name, 36 const struct netr_SamInfo3 *info3, 37 DATA_BLOB session_key, 38 DATA_BLOB delegated_creds); 29 struct tevent_context *ev, 30 const char *directory, 31 const char *npipe, 32 const struct tsocket_address *client, 33 const char *client_name_in, 34 const struct tsocket_address *server, 35 const char *server_name, 36 const struct auth_session_info_transport *session_info); 39 37 int _tstream_npa_connect_recv(struct tevent_req *req, 40 38 int *perrno, … … 58 56 __location__) 59 57 58 59 /** 60 * @brief Accepts a connection for authenticated named pipes 61 * 62 * @param[in] mem_ctx The memory context for the operation 63 * @param[in] ev The tevent_context for the operation 64 * @param[in] plain The plain tstream_context of the bsd unix 65 * domain socket. 66 * This must be valid for the whole life of the 67 * resulting npa tstream_context! 68 * @param[in] file_type The file_type, message mode or byte mode 69 * @param[in] device_state The reported device state 70 * @param[in] allocation_size The reported allocation size 71 * 72 * @return the tevent_req handle 73 */ 74 struct tevent_req *tstream_npa_accept_existing_send(TALLOC_CTX *mem_ctx, 75 struct tevent_context *ev, 76 struct tstream_context *plain, 77 uint16_t file_type, 78 uint16_t device_state, 79 uint64_t allocation_size); 80 81 /** 82 * @brief The receive end of the previous async function 83 * 84 * @param[in] req The tevent_req handle 85 * @param[out] perrno Pointer to store the errno in case of error 86 * @param[in] mem_ctx The memory context for the results 87 * @param[out] stream The resulting stream 88 * @param[out] client The resulting client address 89 * @param[out] client_name The resulting client name 90 * @param[out] server The resulting server address 91 * @param[out] server_name The resulting server name 92 * @param[out] info3 The info3 auth for the connecting user. 93 * @param[out] session_key The resulting session key 94 * @param[out] delegated_creds Delegated credentials 95 * 96 * @return 0 if successful, -1 on failure with *perror filled. 97 */ 98 int _tstream_npa_accept_existing_recv(struct tevent_req *req, 99 int *perrno, 100 TALLOC_CTX *mem_ctx, 101 struct tstream_context **stream, 102 struct tsocket_address **client, 103 char **_client_name, 104 struct tsocket_address **server, 105 char **server_name, 106 struct auth_session_info_transport **session_info, 107 const char *location); 108 #define tstream_npa_accept_existing_recv(req, perrno, \ 109 mem_ctx, stream, \ 110 client, client_name, \ 111 server, server_name, \ 112 session_info) \ 113 _tstream_npa_accept_existing_recv(req, perrno, \ 114 mem_ctx, stream, \ 115 client, client_name, \ 116 server, server_name, \ 117 session_info, \ 118 __location__) 119 60 120 #endif /* NPA_TSTREAM_H */ -
vendor/current/libcli/nbt/libnbt.h
r414 r740 96 96 struct socket_context *sock; 97 97 struct tevent_context *event_ctx; 98 struct smb_iconv_convenience *iconv_convenience;99 98 100 99 /* a queue of requests pending to be sent */ … … 276 275 277 276 struct nbt_name_socket *nbt_name_socket_init(TALLOC_CTX *mem_ctx, 278 struct tevent_context *event_ctx, 279 struct smb_iconv_convenience *iconv_convenience); 277 struct tevent_context *event_ctx); 280 278 void nbt_name_socket_handle_response_packet(struct nbt_name_request *req, 281 279 struct nbt_name_packet *packet, … … 295 293 296 294 NTSTATUS nbt_name_dup(TALLOC_CTX *mem_ctx, struct nbt_name *name, struct nbt_name *newname); 297 NTSTATUS nbt_name_to_blob(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience,DATA_BLOB *blob, struct nbt_name *name);295 NTSTATUS nbt_name_to_blob(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, struct nbt_name *name); 298 296 NTSTATUS nbt_name_from_blob(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, struct nbt_name *name); 299 297 void nbt_choose_called_name(TALLOC_CTX *mem_ctx, struct nbt_name *n, const char *name, int type); … … 342 340 NTSTATUS nbt_rcode_to_ntstatus(uint8_t rcode); 343 341 344 struct composite_context; 345 struct composite_context *nbt_name_register_bcast_send(struct nbt_name_socket *nbtsock, 346 struct nbt_name_register_bcast *io); 347 NTSTATUS nbt_name_register_bcast_recv(struct composite_context *c); 348 struct composite_context *nbt_name_register_wins_send(struct nbt_name_socket *nbtsock, 349 struct nbt_name_register_wins *io); 350 NTSTATUS nbt_name_refresh_wins_recv(struct composite_context *c, TALLOC_CTX *mem_ctx, 351 struct nbt_name_refresh_wins *io); 352 struct composite_context *nbt_name_refresh_wins_send(struct nbt_name_socket *nbtsock, 353 struct nbt_name_refresh_wins *io); 354 NTSTATUS nbt_name_register_wins_recv(struct composite_context *c, TALLOC_CTX *mem_ctx, 342 struct tevent_context; 343 struct tevent_req; 344 struct tevent_req *nbt_name_register_bcast_send(TALLOC_CTX *mem_ctx, 345 struct tevent_context *ev, 346 struct nbt_name_socket *nbtsock, 347 struct nbt_name_register_bcast *io); 348 NTSTATUS nbt_name_register_bcast_recv(struct tevent_req *req); 349 struct tevent_req *nbt_name_register_wins_send(TALLOC_CTX *mem_ctx, 350 struct tevent_context *ev, 351 struct nbt_name_socket *nbtsock, 352 struct nbt_name_register_wins *io); 353 NTSTATUS nbt_name_register_wins_recv(struct tevent_req *req, 354 TALLOC_CTX *mem_ctx, 355 355 struct nbt_name_register_wins *io); 356 356 struct tevent_req *nbt_name_refresh_wins_send(TALLOC_CTX *mem_ctx, 357 struct tevent_context *ev, 358 struct nbt_name_socket *nbtsock, 359 struct nbt_name_refresh_wins *io); 360 NTSTATUS nbt_name_refresh_wins_recv(struct tevent_req *req, 361 TALLOC_CTX *mem_ctx, 362 struct nbt_name_refresh_wins *io); 357 363 358 364 XFILE *startlmhosts(const char *fname); … … 361 367 void endlmhosts(XFILE *fp); 362 368 369 NTSTATUS resolve_lmhosts_file_as_sockaddr(const char *lmhosts_file, 370 const char *name, int name_type, 371 TALLOC_CTX *mem_ctx, 372 struct sockaddr_storage **return_iplist, 373 int *return_count); 374 375 NTSTATUS resolve_dns_hosts_file_as_sockaddr(const char *dns_hosts_file, 376 const char *name, bool srv_lookup, 377 TALLOC_CTX *mem_ctx, 378 struct sockaddr_storage **return_iplist, 379 int *return_count); 380 363 381 #endif /* __LIBNBT_H__ */ -
vendor/current/libcli/nbt/lmhosts.c
r414 r740 27 27 #include "system/filesys.h" 28 28 #include "system/network.h" 29 #include "../libcli/nbt/libnbt.h" 29 30 30 31 /******************************************************** … … 156 157 } 157 158 159 /******************************************************** 160 Resolve via "lmhosts" method. 161 *********************************************************/ 162 163 NTSTATUS resolve_lmhosts_file_as_sockaddr(const char *lmhosts_file, 164 const char *name, int name_type, 165 TALLOC_CTX *mem_ctx, 166 struct sockaddr_storage **return_iplist, 167 int *return_count) 168 { 169 /* 170 * "lmhosts" means parse the local lmhosts file. 171 */ 172 173 XFILE *fp; 174 char *lmhost_name = NULL; 175 int name_type2; 176 struct sockaddr_storage return_ss; 177 NTSTATUS status = NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND; 178 TALLOC_CTX *ctx = NULL; 179 180 *return_iplist = NULL; 181 *return_count = 0; 182 183 DEBUG(3,("resolve_lmhosts: " 184 "Attempting lmhosts lookup for name %s<0x%x>\n", 185 name, name_type)); 186 187 fp = startlmhosts(lmhosts_file); 188 189 if ( fp == NULL ) 190 return NT_STATUS_NO_SUCH_FILE; 191 192 ctx = talloc_new(mem_ctx); 193 if (!ctx) { 194 endlmhosts(fp); 195 return NT_STATUS_NO_MEMORY; 196 } 197 198 while (getlmhostsent(ctx, fp, &lmhost_name, &name_type2, &return_ss)) { 199 200 if (!strequal(name, lmhost_name)) { 201 TALLOC_FREE(lmhost_name); 202 continue; 203 } 204 205 if ((name_type2 != -1) && (name_type != name_type2)) { 206 TALLOC_FREE(lmhost_name); 207 continue; 208 } 209 210 *return_iplist = talloc_realloc(ctx, (*return_iplist), 211 struct sockaddr_storage, 212 (*return_count)+1); 213 214 if ((*return_iplist) == NULL) { 215 TALLOC_FREE(ctx); 216 endlmhosts(fp); 217 DEBUG(3,("resolve_lmhosts: talloc_realloc fail !\n")); 218 return NT_STATUS_NO_MEMORY; 219 } 220 221 (*return_iplist)[*return_count] = return_ss; 222 *return_count += 1; 223 224 /* we found something */ 225 status = NT_STATUS_OK; 226 227 /* Multiple names only for DC lookup */ 228 if (name_type != 0x1c) 229 break; 230 } 231 232 talloc_steal(mem_ctx, *return_iplist); 233 TALLOC_FREE(ctx); 234 endlmhosts(fp); 235 return status; 236 } 237 -
vendor/current/libcli/nbt/man/nmblookup.1.xml
r414 r740 1 1 <?xml version="1.0" encoding="iso-8859-1"?> 2 <!DOCTYPE refentry PUBLIC "-// Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> 3 3 <refentry id="nmblookup"> 4 4 … … 107 107 </varlistentry> 108 108 109 110 111 &popt.common.connection;112 &stdarg.help;113 114 109 <varlistentry> 115 110 <term>-B <broadcast address></term> … … 124 119 </varlistentry> 125 120 126 127 128 121 <varlistentry> 129 122 <term>-U <unicast address></term> … … 133 126 query a WINS server.</para></listitem> 134 127 </varlistentry> 135 136 &stdarg.server.debug;137 &popt.common.samba;138 128 139 129 <varlistentry> -
vendor/current/libcli/nbt/namerefresh.c
r414 r740 21 21 22 22 #include "includes.h" 23 #include <tevent.h> 23 24 #include "../libcli/nbt/libnbt.h" 24 25 #include "../libcli/nbt/nbt_proto.h" 25 #include "libcli/composite/composite.h"26 26 #include "lib/socket/socket.h" 27 #include "lib/util/tevent_ntstatus.h" 27 28 28 29 /* … … 143 144 reply for each address 144 145 */ 145 struct refresh_wins_state {146 struct nbt_name_refresh_wins_state { 146 147 struct nbt_name_socket *nbtsock; 147 148 struct nbt_name_refresh *io; 148 c onst char **wins_servers;149 char **wins_servers; 149 150 uint16_t wins_port; 150 c onst char **addresses;151 char **addresses; 151 152 int address_idx; 152 struct nbt_name_request *req;153 153 }; 154 154 155 156 /** 157 state handler for WINS multi-homed multi-server name refresh 158 */ 159 static void name_refresh_wins_handler(struct nbt_name_request *req) 160 { 161 struct composite_context *c = talloc_get_type(req->async.private_data, 162 struct composite_context); 163 struct refresh_wins_state *state = talloc_get_type(c->private_data, 164 struct refresh_wins_state); 165 NTSTATUS status; 166 167 status = nbt_name_refresh_recv(state->req, state, state->io); 168 if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) { 169 /* the refresh timed out - try the next WINS server */ 170 state->wins_servers++; 171 state->address_idx = 0; 172 if (state->wins_servers[0] == NULL) { 173 c->state = COMPOSITE_STATE_ERROR; 174 c->status = status; 175 goto done; 176 } 177 state->io->in.dest_addr = state->wins_servers[0]; 178 state->io->in.dest_port = state->wins_port; 179 state->io->in.address = state->addresses[0]; 180 state->req = nbt_name_refresh_send(state->nbtsock, state->io); 181 if (state->req == NULL) { 182 c->state = COMPOSITE_STATE_ERROR; 183 c->status = NT_STATUS_NO_MEMORY; 184 } else { 185 state->req->async.fn = name_refresh_wins_handler; 186 state->req->async.private_data = c; 187 } 188 } else if (!NT_STATUS_IS_OK(status)) { 189 c->state = COMPOSITE_STATE_ERROR; 190 c->status = status; 191 } else { 192 if (state->io->out.rcode == 0 && 193 state->addresses[state->address_idx+1] != NULL) { 194 /* refresh our next address */ 195 state->io->in.address = state->addresses[++(state->address_idx)]; 196 state->req = nbt_name_refresh_send(state->nbtsock, state->io); 197 if (state->req == NULL) { 198 c->state = COMPOSITE_STATE_ERROR; 199 c->status = NT_STATUS_NO_MEMORY; 200 } else { 201 state->req->async.fn = name_refresh_wins_handler; 202 state->req->async.private_data = c; 203 } 204 } else { 205 c->state = COMPOSITE_STATE_DONE; 206 c->status = NT_STATUS_OK; 207 } 208 } 209 210 done: 211 if (c->state >= COMPOSITE_STATE_DONE && 212 c->async.fn) { 213 c->async.fn(c); 214 } 215 } 155 static void nbt_name_refresh_wins_handler(struct nbt_name_request *subreq); 216 156 217 157 /** 218 158 the async send call for a multi-server WINS refresh 219 159 */ 220 _PUBLIC_ struct composite_context *nbt_name_refresh_wins_send(struct nbt_name_socket *nbtsock, 221 struct nbt_name_refresh_wins *io) 222 { 223 struct composite_context *c; 224 struct refresh_wins_state *state; 225 226 c = talloc_zero(nbtsock, struct composite_context); 227 if (c == NULL) goto failed; 228 229 state = talloc(c, struct refresh_wins_state); 230 if (state == NULL) goto failed; 160 _PUBLIC_ struct tevent_req *nbt_name_refresh_wins_send(TALLOC_CTX *mem_ctx, 161 struct tevent_context *ev, 162 struct nbt_name_socket *nbtsock, 163 struct nbt_name_refresh_wins *io) 164 { 165 struct tevent_req *req; 166 struct nbt_name_refresh_wins_state *state; 167 struct nbt_name_request *subreq; 168 169 req = tevent_req_create(mem_ctx, &state, 170 struct nbt_name_refresh_wins_state); 171 if (req == NULL) { 172 return NULL; 173 } 231 174 232 175 state->io = talloc(state, struct nbt_name_refresh); 233 if (state->io == NULL) goto failed; 176 if (tevent_req_nomem(state->io, req)) { 177 return tevent_req_post(req, ev); 178 } 179 180 if (io->in.wins_servers == NULL) { 181 tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER); 182 return tevent_req_post(req, ev); 183 } 184 185 if (io->in.wins_servers[0] == NULL) { 186 tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER); 187 return tevent_req_post(req, ev); 188 } 189 190 if (io->in.addresses == NULL) { 191 tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER); 192 return tevent_req_post(req, ev); 193 } 194 195 if (io->in.addresses[0] == NULL) { 196 tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER); 197 return tevent_req_post(req, ev); 198 } 234 199 235 200 state->wins_port = io->in.wins_port; 236 state->wins_servers = (const char **)str_list_copy(state, io->in.wins_servers); 237 if (state->wins_servers == NULL || 238 state->wins_servers[0] == NULL) goto failed; 239 240 state->addresses = (const char **)str_list_copy(state, io->in.addresses); 241 if (state->addresses == NULL || 242 state->addresses[0] == NULL) goto failed; 201 state->wins_servers = str_list_copy(state, io->in.wins_servers); 202 if (tevent_req_nomem(state->wins_servers, req)) { 203 return tevent_req_post(req, ev); 204 } 205 206 state->addresses = str_list_copy(state, io->in.addresses); 207 if (tevent_req_nomem(state->addresses, req)) { 208 return tevent_req_post(req, ev); 209 } 243 210 244 211 state->io->in.name = io->in.name; … … 255 222 state->address_idx = 0; 256 223 257 state->req = nbt_name_refresh_send(nbtsock, state->io); 258 if (state->req == NULL) goto failed; 259 260 state->req->async.fn = name_refresh_wins_handler; 261 state->req->async.private_data = c; 262 263 c->private_data = state; 264 c->state = COMPOSITE_STATE_IN_PROGRESS; 265 c->event_ctx = nbtsock->event_ctx; 266 267 return c; 268 269 failed: 270 talloc_free(c); 271 return NULL; 224 subreq = nbt_name_refresh_send(nbtsock, state->io); 225 if (tevent_req_nomem(subreq, req)) { 226 return tevent_req_post(req, ev); 227 } 228 229 subreq->async.fn = nbt_name_refresh_wins_handler; 230 subreq->async.private_data = req; 231 232 return req; 233 } 234 235 static void nbt_name_refresh_wins_handler(struct nbt_name_request *subreq) 236 { 237 struct tevent_req *req = 238 talloc_get_type_abort(subreq->async.private_data, 239 struct tevent_req); 240 struct nbt_name_refresh_wins_state *state = 241 tevent_req_data(req, 242 struct nbt_name_refresh_wins_state); 243 NTSTATUS status; 244 245 status = nbt_name_refresh_recv(subreq, state, state->io); 246 if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) { 247 /* the refresh timed out - try the next WINS server */ 248 state->wins_servers++; 249 if (state->wins_servers[0] == NULL) { 250 tevent_req_nterror(req, status); 251 return; 252 } 253 254 state->address_idx = 0; 255 state->io->in.dest_addr = state->wins_servers[0]; 256 state->io->in.dest_port = state->wins_port; 257 state->io->in.address = state->addresses[0]; 258 259 subreq = nbt_name_refresh_send(state->nbtsock, state->io); 260 if (tevent_req_nomem(subreq, req)) { 261 return; 262 } 263 subreq->async.fn = nbt_name_refresh_wins_handler; 264 subreq->async.private_data = req; 265 } else if (!NT_STATUS_IS_OK(status)) { 266 tevent_req_nterror(req, status); 267 return; 268 } 269 270 if (state->io->out.rcode == 0 && 271 state->addresses[state->address_idx+1] != NULL) { 272 /* refresh our next address */ 273 state->io->in.address = state->addresses[++(state->address_idx)]; 274 subreq = nbt_name_refresh_send(state->nbtsock, state->io); 275 if (tevent_req_nomem(subreq, req)) { 276 return; 277 } 278 subreq->async.fn = nbt_name_refresh_wins_handler; 279 subreq->async.private_data = req; 280 return; 281 } 282 283 tevent_req_done(req); 272 284 } 273 285 … … 275 287 multi-homed WINS name refresh - recv side 276 288 */ 277 _PUBLIC_ NTSTATUS nbt_name_refresh_wins_recv(struct composite_context *c, TALLOC_CTX *mem_ctx, 278 struct nbt_name_refresh_wins *io) 279 { 289 _PUBLIC_ NTSTATUS nbt_name_refresh_wins_recv(struct tevent_req *req, 290 TALLOC_CTX *mem_ctx, 291 struct nbt_name_refresh_wins *io) 292 { 293 struct nbt_name_refresh_wins_state *state = 294 tevent_req_data(req, 295 struct nbt_name_refresh_wins_state); 280 296 NTSTATUS status; 281 status = composite_wait(c); 282 if (NT_STATUS_IS_OK(status)) { 283 struct refresh_wins_state *state = 284 talloc_get_type(c->private_data, struct refresh_wins_state); 285 io->out.wins_server = talloc_steal(mem_ctx, state->wins_servers[0]); 286 io->out.rcode = state->io->out.rcode; 287 } 288 talloc_free(c); 289 return status; 297 298 if (tevent_req_is_nterror(req, &status)) { 299 tevent_req_received(req); 300 return status; 301 } 302 303 io->out.wins_server = talloc_move(mem_ctx, &state->wins_servers[0]); 304 io->out.rcode = state->io->out.rcode; 305 306 tevent_req_received(req); 307 return NT_STATUS_OK; 290 308 } 291 309 … … 294 312 */ 295 313 _PUBLIC_ NTSTATUS nbt_name_refresh_wins(struct nbt_name_socket *nbtsock, 296 TALLOC_CTX *mem_ctx, 297 struct nbt_name_refresh_wins *io) 298 { 299 struct composite_context *c = nbt_name_refresh_wins_send(nbtsock, io); 300 return nbt_name_refresh_wins_recv(c, mem_ctx, io); 301 } 314 TALLOC_CTX *mem_ctx, 315 struct nbt_name_refresh_wins *io) 316 { 317 TALLOC_CTX *frame = talloc_stackframe(); 318 struct tevent_context *ev; 319 struct tevent_req *subreq; 320 NTSTATUS status; 321 322 /* 323 * TODO: create a temporary event context 324 */ 325 ev = nbtsock->event_ctx; 326 327 subreq = nbt_name_refresh_wins_send(frame, ev, nbtsock, io); 328 if (subreq == NULL) { 329 talloc_free(frame); 330 return NT_STATUS_NO_MEMORY; 331 } 332 333 if (!tevent_req_poll(subreq, ev)) { 334 status = map_nt_error_from_unix(errno); 335 talloc_free(frame); 336 return status; 337 } 338 339 status = nbt_name_refresh_wins_recv(subreq, mem_ctx, io); 340 if (!NT_STATUS_IS_OK(status)) { 341 talloc_free(frame); 342 return status; 343 } 344 345 TALLOC_FREE(frame); 346 return NT_STATUS_OK; 347 } -
vendor/current/libcli/nbt/nameregister.c
r414 r740 21 21 22 22 #include "includes.h" 23 #include <tevent.h> 23 24 #include "../libcli/nbt/libnbt.h" 24 25 #include "../libcli/nbt/nbt_proto.h" 25 #include "libcli/composite/composite.h"26 26 #include "lib/socket/socket.h" 27 27 #include "librpc/gen_ndr/ndr_nbt.h" 28 #include "../lib/util/tevent_ntstatus.h" 28 29 29 30 /* … … 149 150 a name registration demand 150 151 */ 151 struct register_bcast_state {152 struct nbt_name_register_bcast_state { 152 153 struct nbt_name_socket *nbtsock; 153 struct nbt_name_register *io; 154 struct nbt_name_request *req; 154 struct nbt_name_register io; 155 155 }; 156 156 157 158 /* 159 state handler for 4 stage name registration 160 */ 161 static void name_register_bcast_handler(struct nbt_name_request *req) 162 { 163 struct composite_context *c = talloc_get_type(req->async.private_data, struct composite_context); 164 struct register_bcast_state *state = talloc_get_type(c->private_data, struct register_bcast_state); 165 NTSTATUS status; 166 167 status = nbt_name_register_recv(state->req, state, state->io); 157 static void nbt_name_register_bcast_handler(struct nbt_name_request *subreq); 158 159 /* 160 the async send call for a 4 stage name registration 161 */ 162 _PUBLIC_ struct tevent_req *nbt_name_register_bcast_send(TALLOC_CTX *mem_ctx, 163 struct tevent_context *ev, 164 struct nbt_name_socket *nbtsock, 165 struct nbt_name_register_bcast *io) 166 { 167 struct tevent_req *req; 168 struct nbt_name_register_bcast_state *state; 169 struct nbt_name_request *subreq; 170 171 req = tevent_req_create(mem_ctx, &state, 172 struct nbt_name_register_bcast_state); 173 if (req == NULL) { 174 return NULL; 175 } 176 177 state->io.in.name = io->in.name; 178 state->io.in.dest_addr = io->in.dest_addr; 179 state->io.in.dest_port = io->in.dest_port; 180 state->io.in.address = io->in.address; 181 state->io.in.nb_flags = io->in.nb_flags; 182 state->io.in.register_demand = false; 183 state->io.in.broadcast = true; 184 state->io.in.multi_homed = false; 185 state->io.in.ttl = io->in.ttl; 186 state->io.in.timeout = 1; 187 state->io.in.retries = 2; 188 189 state->nbtsock = nbtsock; 190 191 subreq = nbt_name_register_send(nbtsock, &state->io); 192 if (tevent_req_nomem(subreq, req)) { 193 return tevent_req_post(req, ev); 194 } 195 196 subreq->async.fn = nbt_name_register_bcast_handler; 197 subreq->async.private_data = req; 198 199 return req; 200 } 201 202 static void nbt_name_register_bcast_handler(struct nbt_name_request *subreq) 203 { 204 struct tevent_req *req = 205 talloc_get_type_abort(subreq->async.private_data, 206 struct tevent_req); 207 struct nbt_name_register_bcast_state *state = 208 tevent_req_data(req, 209 struct nbt_name_register_bcast_state); 210 NTSTATUS status; 211 212 status = nbt_name_register_recv(subreq, state, &state->io); 168 213 if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) { 169 if (state->io->in.register_demand == true) { 170 /* all done */ 171 c->state = COMPOSITE_STATE_DONE; 172 c->status = NT_STATUS_OK; 173 goto done; 214 if (state->io.in.register_demand == true) { 215 tevent_req_done(req); 216 return; 174 217 } 175 218 176 219 /* the registration timed out - good, send the demand */ 177 state->io->in.register_demand = true; 178 state->io->in.retries = 0; 179 state->req = nbt_name_register_send(state->nbtsock, state->io); 180 if (state->req == NULL) { 181 c->state = COMPOSITE_STATE_ERROR; 182 c->status = NT_STATUS_NO_MEMORY; 183 } else { 184 state->req->async.fn = name_register_bcast_handler; 185 state->req->async.private_data = c; 220 state->io.in.register_demand = true; 221 state->io.in.retries = 0; 222 223 subreq = nbt_name_register_send(state->nbtsock, &state->io); 224 if (tevent_req_nomem(subreq, req)) { 225 return; 186 226 } 187 } else if (!NT_STATUS_IS_OK(status)) { 188 c->state = COMPOSITE_STATE_ERROR; 189 c->status = status; 190 } else { 191 c->state = COMPOSITE_STATE_ERROR; 192 c->status = NT_STATUS_CONFLICTING_ADDRESSES; 193 DEBUG(3,("Name registration conflict from %s for %s with ip %s - rcode %d\n", 194 state->io->out.reply_from, 195 nbt_name_string(state, &state->io->out.name), 196 state->io->out.reply_addr, 197 state->io->out.rcode)); 198 } 199 200 done: 201 if (c->state >= COMPOSITE_STATE_DONE && 202 c->async.fn) { 203 c->async.fn(c); 204 } 205 } 206 207 /* 208 the async send call for a 4 stage name registration 209 */ 210 _PUBLIC_ struct composite_context *nbt_name_register_bcast_send(struct nbt_name_socket *nbtsock, 211 struct nbt_name_register_bcast *io) 212 { 213 struct composite_context *c; 214 struct register_bcast_state *state; 215 216 c = talloc_zero(nbtsock, struct composite_context); 217 if (c == NULL) goto failed; 218 219 state = talloc(c, struct register_bcast_state); 220 if (state == NULL) goto failed; 221 222 state->io = talloc(state, struct nbt_name_register); 223 if (state->io == NULL) goto failed; 224 225 state->io->in.name = io->in.name; 226 state->io->in.dest_addr = io->in.dest_addr; 227 state->io->in.dest_port = io->in.dest_port; 228 state->io->in.address = io->in.address; 229 state->io->in.nb_flags = io->in.nb_flags; 230 state->io->in.register_demand = false; 231 state->io->in.broadcast = true; 232 state->io->in.multi_homed = false; 233 state->io->in.ttl = io->in.ttl; 234 state->io->in.timeout = 1; 235 state->io->in.retries = 2; 236 237 state->nbtsock = nbtsock; 238 239 state->req = nbt_name_register_send(nbtsock, state->io); 240 if (state->req == NULL) goto failed; 241 242 state->req->async.fn = name_register_bcast_handler; 243 state->req->async.private_data = c; 244 245 c->private_data = state; 246 c->state = COMPOSITE_STATE_IN_PROGRESS; 247 c->event_ctx = nbtsock->event_ctx; 248 249 return c; 250 251 failed: 252 talloc_free(c); 253 return NULL; 227 228 subreq->async.fn = nbt_name_register_bcast_handler; 229 subreq->async.private_data = req; 230 return; 231 } 232 233 if (!NT_STATUS_IS_OK(status)) { 234 tevent_req_nterror(req, status); 235 return; 236 } 237 238 DEBUG(3,("Name registration conflict from %s for %s with ip %s - rcode %d\n", 239 state->io.out.reply_from, 240 nbt_name_string(state, &state->io.out.name), 241 state->io.out.reply_addr, 242 state->io.out.rcode)); 243 244 tevent_req_nterror(req, NT_STATUS_CONFLICTING_ADDRESSES); 254 245 } 255 246 … … 257 248 broadcast 4 part name register - recv 258 249 */ 259 _PUBLIC_ NTSTATUS nbt_name_register_bcast_recv(struct composite_context *c) 260 { 261 NTSTATUS status; 262 status = composite_wait(c); 263 talloc_free(c); 264 return status; 250 _PUBLIC_ NTSTATUS nbt_name_register_bcast_recv(struct tevent_req *req) 251 { 252 NTSTATUS status; 253 254 if (tevent_req_is_nterror(req, &status)) { 255 tevent_req_received(req); 256 return status; 257 } 258 259 tevent_req_received(req); 260 return NT_STATUS_OK; 265 261 } 266 262 … … 271 267 struct nbt_name_register_bcast *io) 272 268 { 273 struct composite_context *c = nbt_name_register_bcast_send(nbtsock, io); 274 return nbt_name_register_bcast_recv(c); 269 TALLOC_CTX *frame = talloc_stackframe(); 270 struct tevent_context *ev; 271 struct tevent_req *subreq; 272 NTSTATUS status; 273 274 /* 275 * TODO: create a temporary event context 276 */ 277 ev = nbtsock->event_ctx; 278 279 subreq = nbt_name_register_bcast_send(frame, ev, nbtsock, io); 280 if (subreq == NULL) { 281 talloc_free(frame); 282 return NT_STATUS_NO_MEMORY; 283 } 284 285 if (!tevent_req_poll(subreq, ev)) { 286 status = map_nt_error_from_unix(errno); 287 talloc_free(frame); 288 return status; 289 } 290 291 status = nbt_name_register_bcast_recv(subreq); 292 if (!NT_STATUS_IS_OK(status)) { 293 talloc_free(frame); 294 return status; 295 } 296 297 TALLOC_FREE(frame); 298 return NT_STATUS_OK; 275 299 } 276 300 … … 281 305 reply for each address 282 306 */ 283 struct register_wins_state {307 struct nbt_name_register_wins_state { 284 308 struct nbt_name_socket *nbtsock; 285 struct nbt_name_register *io;286 c onst char **wins_servers;309 struct nbt_name_register io; 310 char **wins_servers; 287 311 uint16_t wins_port; 288 const char **addresses; 289 int address_idx; 290 struct nbt_name_request *req; 312 char **addresses; 313 uint32_t address_idx; 291 314 }; 292 315 316 static void nbt_name_register_wins_handler(struct nbt_name_request *subreq); 317 318 /* 319 the async send call for a multi-server WINS register 320 */ 321 _PUBLIC_ struct tevent_req *nbt_name_register_wins_send(TALLOC_CTX *mem_ctx, 322 struct tevent_context *ev, 323 struct nbt_name_socket *nbtsock, 324 struct nbt_name_register_wins *io) 325 { 326 struct tevent_req *req; 327 struct nbt_name_register_wins_state *state; 328 struct nbt_name_request *subreq; 329 330 req = tevent_req_create(mem_ctx, &state, 331 struct nbt_name_register_wins_state); 332 if (req == NULL) { 333 return NULL; 334 } 335 336 if (io->in.wins_servers == NULL) { 337 tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER); 338 return tevent_req_post(req, ev); 339 } 340 341 if (io->in.wins_servers[0] == NULL) { 342 tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER); 343 return tevent_req_post(req, ev); 344 } 345 346 if (io->in.addresses == NULL) { 347 tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER); 348 return tevent_req_post(req, ev); 349 } 350 351 if (io->in.addresses[0] == NULL) { 352 tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER); 353 return tevent_req_post(req, ev); 354 } 355 356 state->wins_port = io->in.wins_port; 357 state->wins_servers = str_list_copy(state, io->in.wins_servers); 358 if (tevent_req_nomem(state->wins_servers, req)) { 359 return tevent_req_post(req, ev); 360 } 361 362 state->addresses = str_list_copy(state, io->in.addresses); 363 if (tevent_req_nomem(state->addresses, req)) { 364 return tevent_req_post(req, ev); 365 } 366 367 state->io.in.name = io->in.name; 368 state->io.in.dest_addr = state->wins_servers[0]; 369 state->io.in.dest_port = state->wins_port; 370 state->io.in.address = io->in.addresses[0]; 371 state->io.in.nb_flags = io->in.nb_flags; 372 state->io.in.broadcast = false; 373 state->io.in.register_demand = false; 374 state->io.in.multi_homed = (io->in.nb_flags & NBT_NM_GROUP)?false:true; 375 state->io.in.ttl = io->in.ttl; 376 state->io.in.timeout = 3; 377 state->io.in.retries = 2; 378 379 state->nbtsock = nbtsock; 380 state->address_idx = 0; 381 382 subreq = nbt_name_register_send(nbtsock, &state->io); 383 if (tevent_req_nomem(subreq, req)) { 384 return tevent_req_post(req, ev); 385 } 386 387 subreq->async.fn = nbt_name_register_wins_handler; 388 subreq->async.private_data = req; 389 390 return req; 391 } 293 392 294 393 /* 295 394 state handler for WINS multi-homed multi-server name register 296 395 */ 297 static void name_register_wins_handler(struct nbt_name_request *req) 298 { 299 struct composite_context *c = talloc_get_type(req->async.private_data, 300 struct composite_context); 301 struct register_wins_state *state = talloc_get_type(c->private_data, 302 struct register_wins_state); 303 NTSTATUS status; 304 305 status = nbt_name_register_recv(state->req, state, state->io); 396 static void nbt_name_register_wins_handler(struct nbt_name_request *subreq) 397 { 398 struct tevent_req *req = 399 talloc_get_type_abort(subreq->async.private_data, 400 struct tevent_req); 401 struct nbt_name_register_wins_state *state = 402 tevent_req_data(req, 403 struct nbt_name_register_wins_state); 404 NTSTATUS status; 405 406 status = nbt_name_register_recv(subreq, state, &state->io); 306 407 if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) { 307 408 /* the register timed out - try the next WINS server */ 308 409 state->wins_servers++; 410 if (state->wins_servers[0] == NULL) { 411 tevent_req_nterror(req, status); 412 return; 413 } 414 309 415 state->address_idx = 0; 310 if (state->wins_servers[0] == NULL) { 311 c->state = COMPOSITE_STATE_ERROR; 312 c->status = status; 313 goto done; 416 state->io.in.dest_addr = state->wins_servers[0]; 417 state->io.in.dest_port = state->wins_port; 418 state->io.in.address = state->addresses[0]; 419 420 subreq = nbt_name_register_send(state->nbtsock, &state->io); 421 if (tevent_req_nomem(subreq, req)) { 422 return; 314 423 } 315 state->io->in.dest_addr = state->wins_servers[0]; 316 state->io->in.dest_port = state->wins_port; 317 state->io->in.address = state->addresses[0]; 318 state->req = nbt_name_register_send(state->nbtsock, state->io); 319 if (state->req == NULL) { 320 c->state = COMPOSITE_STATE_ERROR; 321 c->status = NT_STATUS_NO_MEMORY; 322 } else { 323 state->req->async.fn = name_register_wins_handler; 324 state->req->async.private_data = c; 424 425 subreq->async.fn = nbt_name_register_wins_handler; 426 subreq->async.private_data = req; 427 return; 428 } 429 430 if (!NT_STATUS_IS_OK(status)) { 431 tevent_req_nterror(req, status); 432 return; 433 } 434 435 if (state->io.out.rcode == 0 && 436 state->addresses[state->address_idx+1] != NULL) { 437 /* register our next address */ 438 state->io.in.address = state->addresses[++(state->address_idx)]; 439 440 subreq = nbt_name_register_send(state->nbtsock, &state->io); 441 if (tevent_req_nomem(subreq, req)) { 442 return; 325 443 } 326 } else if (!NT_STATUS_IS_OK(status)) { 327 c->state = COMPOSITE_STATE_ERROR; 328 c->status = status; 329 } else { 330 if (state->io->out.rcode == 0 && 331 state->addresses[state->address_idx+1] != NULL) { 332 /* register our next address */ 333 state->io->in.address = state->addresses[++(state->address_idx)]; 334 state->req = nbt_name_register_send(state->nbtsock, state->io); 335 if (state->req == NULL) { 336 c->state = COMPOSITE_STATE_ERROR; 337 c->status = NT_STATUS_NO_MEMORY; 338 } else { 339 state->req->async.fn = name_register_wins_handler; 340 state->req->async.private_data = c; 341 } 342 } else { 343 c->state = COMPOSITE_STATE_DONE; 344 c->status = NT_STATUS_OK; 345 } 346 } 347 348 done: 349 if (c->state >= COMPOSITE_STATE_DONE && 350 c->async.fn) { 351 c->async.fn(c); 352 } 353 } 354 355 /* 356 the async send call for a multi-server WINS register 357 */ 358 _PUBLIC_ struct composite_context *nbt_name_register_wins_send(struct nbt_name_socket *nbtsock, 359 struct nbt_name_register_wins *io) 360 { 361 struct composite_context *c; 362 struct register_wins_state *state; 363 364 c = talloc_zero(nbtsock, struct composite_context); 365 if (c == NULL) goto failed; 366 367 state = talloc(c, struct register_wins_state); 368 if (state == NULL) goto failed; 369 370 state->io = talloc(state, struct nbt_name_register); 371 if (state->io == NULL) goto failed; 372 373 state->wins_port = io->in.wins_port; 374 state->wins_servers = (const char **)str_list_copy(state, io->in.wins_servers); 375 if (state->wins_servers == NULL || 376 state->wins_servers[0] == NULL) goto failed; 377 378 state->addresses = (const char **)str_list_copy(state, io->in.addresses); 379 if (state->addresses == NULL || 380 state->addresses[0] == NULL) goto failed; 381 382 state->io->in.name = io->in.name; 383 state->io->in.dest_addr = state->wins_servers[0]; 384 state->io->in.dest_port = state->wins_port; 385 state->io->in.address = io->in.addresses[0]; 386 state->io->in.nb_flags = io->in.nb_flags; 387 state->io->in.broadcast = false; 388 state->io->in.register_demand = false; 389 state->io->in.multi_homed = (io->in.nb_flags & NBT_NM_GROUP)?false:true; 390 state->io->in.ttl = io->in.ttl; 391 state->io->in.timeout = 3; 392 state->io->in.retries = 2; 393 394 state->nbtsock = nbtsock; 395 state->address_idx = 0; 396 397 state->req = nbt_name_register_send(nbtsock, state->io); 398 if (state->req == NULL) goto failed; 399 400 state->req->async.fn = name_register_wins_handler; 401 state->req->async.private_data = c; 402 403 c->private_data = state; 404 c->state = COMPOSITE_STATE_IN_PROGRESS; 405 c->event_ctx = nbtsock->event_ctx; 406 407 return c; 408 409 failed: 410 talloc_free(c); 411 return NULL; 444 445 subreq->async.fn = nbt_name_register_wins_handler; 446 subreq->async.private_data = req; 447 return; 448 } 449 450 tevent_req_done(req); 412 451 } 413 452 … … 415 454 multi-homed WINS name register - recv side 416 455 */ 417 _PUBLIC_ NTSTATUS nbt_name_register_wins_recv(struct composite_context *c, TALLOC_CTX *mem_ctx, 418 struct nbt_name_register_wins *io) 419 { 420 NTSTATUS status; 421 status = composite_wait(c); 422 if (NT_STATUS_IS_OK(status)) { 423 struct register_wins_state *state = 424 talloc_get_type(c->private_data, struct register_wins_state); 425 io->out.wins_server = talloc_steal(mem_ctx, state->wins_servers[0]); 426 io->out.rcode = state->io->out.rcode; 427 } 428 talloc_free(c); 429 return status; 456 _PUBLIC_ NTSTATUS nbt_name_register_wins_recv(struct tevent_req *req, 457 TALLOC_CTX *mem_ctx, 458 struct nbt_name_register_wins *io) 459 { 460 struct nbt_name_register_wins_state *state = 461 tevent_req_data(req, 462 struct nbt_name_register_wins_state); 463 NTSTATUS status; 464 465 if (tevent_req_is_nterror(req, &status)) { 466 tevent_req_received(req); 467 return status; 468 } 469 470 io->out.wins_server = talloc_move(mem_ctx, &state->wins_servers[0]); 471 io->out.rcode = state->io.out.rcode; 472 473 tevent_req_received(req); 474 return NT_STATUS_OK; 430 475 } 431 476 … … 437 482 struct nbt_name_register_wins *io) 438 483 { 439 struct composite_context *c = nbt_name_register_wins_send(nbtsock, io); 440 return nbt_name_register_wins_recv(c, mem_ctx, io); 441 } 484 TALLOC_CTX *frame = talloc_stackframe(); 485 struct tevent_context *ev; 486 struct tevent_req *subreq; 487 NTSTATUS status; 488 489 /* 490 * TODO: create a temporary event context 491 */ 492 ev = nbtsock->event_ctx; 493 494 subreq = nbt_name_register_wins_send(frame, ev, nbtsock, io); 495 if (subreq == NULL) { 496 talloc_free(frame); 497 return NT_STATUS_NO_MEMORY; 498 } 499 500 if (!tevent_req_poll(subreq, ev)) { 501 status = map_nt_error_from_unix(errno); 502 talloc_free(frame); 503 return status; 504 } 505 506 status = nbt_name_register_wins_recv(subreq, mem_ctx, io); 507 if (!NT_STATUS_IS_OK(status)) { 508 talloc_free(frame); 509 return status; 510 } 511 512 TALLOC_FREE(frame); 513 return NT_STATUS_OK; 514 } -
vendor/current/libcli/nbt/nbt_proto.h
r414 r740 1 /* 2 Unix SMB/CIFS implementation. 3 4 manipulate nbt name structures 5 6 Copyright (C) Andrew Tridgell 2005 7 8 This program is free software; you can redistribute it and/or modify 9 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation; either version 3 of the License, or 11 (at your option) any later version. 12 13 This program is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program. If not, see <http://www.gnu.org/licenses/>. 20 */ 21 1 22 #ifndef _____LIBCLI_NBT_NBT_PROTO_H__ 2 23 #define _____LIBCLI_NBT_NBT_PROTO_H__ -
vendor/current/libcli/nbt/nbtname.c
r594 r740 28 28 #include "librpc/gen_ndr/ndr_misc.h" 29 29 #include "system/locale.h" 30 #include "lib/util/util_net.h" 30 31 31 32 /* don't allow an unlimited number of name components */ … … 49 50 { 50 51 uint8_t len; 51 u int_t loops = 0;52 unsigned int loops = 0; 52 53 while (loops < 5) { 53 54 if (*offset >= ndr->data_size) { … … 176 177 177 178 /* we need to make sure the length fits into 6 bytes */ 178 if (complen > =0x3F) {179 if (complen > 0x3F) { 179 180 return ndr_push_error(ndr, NDR_ERR_STRING, 180 "component length %u[%08X] > 0x0000 3F",181 "component length %u[%08X] > 0x0000003F", 181 182 (unsigned)complen, (unsigned)complen); 182 183 } … … 383 384 push a nbt name into a blob 384 385 */ 385 _PUBLIC_ NTSTATUS nbt_name_to_blob(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience,DATA_BLOB *blob, struct nbt_name *name)386 _PUBLIC_ NTSTATUS nbt_name_to_blob(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, struct nbt_name *name) 386 387 { 387 388 enum ndr_err_code ndr_err; 388 389 389 ndr_err = ndr_push_struct_blob(blob, mem_ctx, iconv_convenience,name, (ndr_push_flags_fn_t)ndr_push_nbt_name);390 ndr_err = ndr_push_struct_blob(blob, mem_ctx, name, (ndr_push_flags_fn_t)ndr_push_nbt_name); 390 391 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { 391 392 return ndr_map_error2ntstatus(ndr_err); … … 402 403 enum ndr_err_code ndr_err; 403 404 404 ndr_err = ndr_pull_struct_blob(blob, mem_ctx, NULL,name,405 ndr_err = ndr_pull_struct_blob(blob, mem_ctx, name, 405 406 (ndr_pull_flags_fn_t)ndr_pull_nbt_name); 406 407 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { … … 520 521 NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, namebuf, namebuf_len)); 521 522 523 if ((namebuf_len % 4) == 0) { 524 /* 525 * [MS-WINSRA] â v20091104 was wrong 526 * regarding section "2.2.10.1 Name Record" 527 * 528 * If the name buffer is already 4 byte aligned 529 * Windows (at least 2003 SP1 and 2008) add 4 extra 530 * bytes. This can happen when the name has a scope. 531 */ 532 uint32_t pad; 533 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &pad)); 534 } 535 522 536 NDR_PULL_ALLOC(ndr, r); 523 537 … … 548 562 if (!r->name) return ndr_pull_error(ndr, NDR_ERR_ALLOC, "out of memory"); 549 563 550 if (namebuf_len > 1 8) {551 r->scope = talloc_strndup(r, (char *)(namebuf+1 7), namebuf_len-17);564 if (namebuf_len > 17) { 565 r->scope = talloc_strndup(r, (char *)(namebuf+16), namebuf_len-17); 552 566 if (!r->scope) return ndr_pull_error(ndr, NDR_ERR_ALLOC, "out of memory"); 553 567 } else { … … 617 631 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, namebuf_len)); 618 632 NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, namebuf, namebuf_len)); 633 634 if ((namebuf_len % 4) == 0) { 635 /* 636 * [MS-WINSRA] â v20091104 was wrong 637 * regarding section "2.2.10.1 Name Record" 638 * 639 * If the name buffer is already 4 byte aligned 640 * Windows (at least 2003 SP1 and 2008) add 4 extra 641 * bytes. This can happen when the name has a scope. 642 */ 643 NDR_CHECK(ndr_push_zero(ndr, 4)); 644 } 619 645 620 646 talloc_free(namebuf); -
vendor/current/libcli/nbt/nbtsocket.c
r414 r740 192 192 193 193 /* parse the request */ 194 ndr_err = ndr_pull_struct_blob(&blob, packet, nbtsock->iconv_convenience,packet,194 ndr_err = ndr_pull_struct_blob(&blob, packet, packet, 195 195 (ndr_pull_flags_fn_t)ndr_pull_nbt_name_packet); 196 196 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { … … 333 333 */ 334 334 _PUBLIC_ struct nbt_name_socket *nbt_name_socket_init(TALLOC_CTX *mem_ctx, 335 struct tevent_context *event_ctx, 336 struct smb_iconv_convenience *iconv_convenience) 335 struct tevent_context *event_ctx) 337 336 { 338 337 struct nbt_name_socket *nbtsock; … … 342 341 if (nbtsock == NULL) goto failed; 343 342 344 nbtsock->event_ctx = talloc_reference(nbtsock, event_ctx);343 nbtsock->event_ctx = event_ctx; 345 344 if (nbtsock->event_ctx == NULL) goto failed; 346 345 … … 359 358 nbtsock->incoming.handler = NULL; 360 359 nbtsock->unexpected.handler = NULL; 361 nbtsock->iconv_convenience = iconv_convenience;362 360 363 361 nbtsock->fde = event_add_fd(nbtsock->event_ctx, nbtsock, … … 417 415 418 416 ndr_err = ndr_push_struct_blob(&req->encoded, req, 419 req->nbtsock->iconv_convenience,420 417 request, 421 418 (ndr_push_flags_fn_t)ndr_push_nbt_name_packet); … … 466 463 467 464 ndr_err = ndr_push_struct_blob(&req->encoded, req, 468 req->nbtsock->iconv_convenience,469 465 request, 470 466 (ndr_push_flags_fn_t)ndr_push_nbt_name_packet); -
vendor/current/libcli/nbt/pynbt.c
r414 r740 18 18 */ 19 19 20 #include <Python.h> 20 21 #include "includes.h" 21 #include <Python.h>22 22 #include "libcli/util/pyerrors.h" 23 23 #include "scripting/python/modules.h" … … 25 25 #include "lib/events/events.h" 26 26 27 void initnetbios(void); 28 27 29 #ifndef Py_RETURN_NONE 28 30 #define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None 29 31 #endif 30 32 31 PyAPI_DATA(PyTypeObject)nbt_node_Type;33 extern PyTypeObject nbt_node_Type; 32 34 33 35 typedef struct { … … 37 39 } nbt_node_Object; 38 40 39 static void py_nbt_node_dealloc( PyObject *obj)40 { 41 talloc_free( ((nbt_node_Object *)obj)->mem_ctx);42 PyObject_Del(obj);41 static void py_nbt_node_dealloc(nbt_node_Object *self) 42 { 43 talloc_free(self->mem_ctx); 44 self->ob_type->tp_free(self); 43 45 } 44 46 … … 53 55 54 56 ev = s4_event_context_init(ret->mem_ctx); 55 ret->socket = nbt_name_socket_init(ret->mem_ctx, ev , py_iconv_convenience(ret->mem_ctx));57 ret->socket = nbt_name_socket_init(ret->mem_ctx, ev); 56 58 return (PyObject *)ret; 57 59 } … … 125 127 } 126 128 127 static PyObject *PyObject_FromNBTName(struct nbt_name_socket *name_socket, struct smb_iconv_convenience *ic,129 static PyObject *PyObject_FromNBTName(struct nbt_name_socket *name_socket, 128 130 struct nbt_name *name) 129 131 { … … 176 178 PyTuple_SetItem(ret, 0, PyString_FromString(io.out.reply_from)); 177 179 178 py_name = PyObject_FromNBTName(node->socket, py_iconv_convenience(node->socket),&io.out.name);180 py_name = PyObject_FromNBTName(node->socket, &io.out.name); 179 181 if (py_name == NULL) 180 182 return NULL; … … 234 236 PyTuple_SetItem(ret, 0, PyString_FromString(io.out.reply_from)); 235 237 236 py_name = PyObject_FromNBTName(node->socket, py_iconv_convenience(NULL),&io.out.name);238 py_name = PyObject_FromNBTName(node->socket, &io.out.name); 237 239 if (py_name == NULL) 238 240 return NULL; … … 297 299 PyTuple_SetItem(ret, 0, PyString_FromString(io.out.reply_from)); 298 300 299 py_name = PyObject_FromNBTName(node->socket, py_iconv_convenience(NULL),&io.out.name);301 py_name = PyObject_FromNBTName(node->socket, &io.out.name); 300 302 if (py_name == NULL) 301 303 return NULL; … … 352 354 PyTuple_SetItem(ret, 0, PyString_FromString(io.out.reply_from)); 353 355 354 py_name = PyObject_FromNBTName(node->socket, py_iconv_convenience(NULL),&io.out.name);356 py_name = PyObject_FromNBTName(node->socket, &io.out.name); 355 357 if (py_name == NULL) 356 358 return NULL; … … 394 396 .tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, 395 397 .tp_new = py_nbt_node_init, 396 .tp_dealloc = py_nbt_node_dealloc,398 .tp_dealloc = (destructor)py_nbt_node_dealloc, 397 399 .tp_methods = py_nbt_methods, 398 400 .tp_doc = "Node()\n" -
vendor/current/libcli/nbt/tools/nmblookup.c
r414 r740 213 213 } 214 214 215 nbtsock = nbt_name_socket_init(tmp_ctx, ev , lp_iconv_convenience(lp_ctx));215 nbtsock = nbt_name_socket_init(tmp_ctx, ev); 216 216 217 217 if (options.root_port) { … … 358 358 } 359 359 360 load_interfaces(NULL, lp _interfaces(cmdline_lp_ctx), &ifaces);360 load_interfaces(NULL, lpcfg_interfaces(cmdline_lp_ctx), &ifaces); 361 361 362 362 ev = s4_event_context_init(talloc_autofree_context()); … … 365 365 const char *name = poptGetArg(pc); 366 366 367 ret &= process_one(cmdline_lp_ctx, ev, ifaces, name, lp _nbt_port(cmdline_lp_ctx));367 ret &= process_one(cmdline_lp_ctx, ev, ifaces, name, lpcfg_nbt_port(cmdline_lp_ctx)); 368 368 } 369 369 -
vendor/current/libcli/samsync/decrypt.c
r414 r740 80 80 user->user_private_info.DataLength = data.length; 81 81 82 ndr_err = ndr_pull_struct_blob(&data, mem_ctx, NULL,&keys,82 ndr_err = ndr_pull_struct_blob(&data, mem_ctx, &keys, 83 83 (ndr_pull_flags_fn_t)ndr_pull_netr_USER_KEYS); 84 84 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { -
vendor/current/libcli/samsync/samsync.h
r414 r740 23 23 #define __SAMSYNC_SAMSYNC_H__ 24 24 25 struct netlogon_creds_CredentialState; 26 25 27 /** 26 28 * Fix up the delta, dealing with encryption issues so that the final -
vendor/current/libcli/security/display_sec.c
r414 r740 20 20 21 21 #include "includes.h" 22 #include "librpc/gen_ndr/security.h" 23 #include "libcli/security/secace.h" 24 #include "libcli/security/dom_sid.h" 22 #include "libcli/security/security.h" 25 23 #include "librpc/ndr/libndr.h" 24 #include "libcli/security/display_sec.h" 26 25 27 26 /**************************************************************************** … … 160 159 static void disp_sec_ace_object(struct security_ace_object *object) 161 160 { 161 char *str; 162 162 if (object->flags & SEC_ACE_OBJECT_TYPE_PRESENT) { 163 str = GUID_string(NULL, &object->type.type); 164 if (str == NULL) return; 163 165 printf("Object type: SEC_ACE_OBJECT_TYPE_PRESENT\n"); 164 printf("Object GUID: %s\n", GUID_string(talloc_tos(),165 &object->type.type));166 printf("Object GUID: %s\n", str); 167 talloc_free(str); 166 168 } 167 169 if (object->flags & SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT) { 170 str = GUID_string(NULL, &object->inherited_type.inherited_type); 171 if (str == NULL) return; 168 172 printf("Object type: SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT\n"); 169 printf("Object GUID: %s\n", GUID_string(talloc_tos(),170 &object->inherited_type.inherited_type));173 printf("Object GUID: %s\n", str); 174 talloc_free(str); 171 175 } 172 176 } … … 231 235 void display_sec_acl(struct security_acl *sec_acl) 232 236 { 233 int i;234 235 printf("\tACL\tNum ACEs:\t% d\trevision:\t%x\n",237 uint32_t i; 238 239 printf("\tACL\tNum ACEs:\t%u\trevision:\t%x\n", 236 240 sec_acl->num_aces, sec_acl->revision); 237 241 printf("\t---\n"); -
vendor/current/libcli/security/dom_sid.c
r581 r740 29 29 *****************************************************************/ 30 30 31 staticint dom_sid_compare_auth(const struct dom_sid *sid1,32 31 int dom_sid_compare_auth(const struct dom_sid *sid1, 32 const struct dom_sid *sid2) 33 33 { 34 34 int i; … … 86 86 } 87 87 88 /* Yes, I did think about multibyte issues here, and for all I can see there's 89 * none of those for parsing a SID. */ 90 #undef strncasecmp 88 /***************************************************************** 89 Add a rid to the end of a sid 90 *****************************************************************/ 91 92 bool sid_append_rid(struct dom_sid *sid, uint32_t rid) 93 { 94 if (sid->num_auths < ARRAY_SIZE(sid->sub_auths)) { 95 sid->sub_auths[sid->num_auths++] = rid; 96 return true; 97 } 98 return false; 99 } 100 101 /* 102 See if 2 SIDs are in the same domain 103 this just compares the leading sub-auths 104 */ 105 int dom_sid_compare_domain(const struct dom_sid *sid1, 106 const struct dom_sid *sid2) 107 { 108 int n, i; 109 110 n = MIN(sid1->num_auths, sid2->num_auths); 111 112 for (i = n-1; i >= 0; --i) 113 if (sid1->sub_auths[i] != sid2->sub_auths[i]) 114 return sid1->sub_auths[i] - sid2->sub_auths[i]; 115 116 return dom_sid_compare_auth(sid1, sid2); 117 } 118 119 /***************************************************************** 120 Convert a string to a SID. Returns True on success, False on fail. 121 Return the first character not parsed in endp. 122 *****************************************************************/ 123 124 bool dom_sid_parse_endp(const char *sidstr,struct dom_sid *sidout, 125 const char **endp) 126 { 127 const char *p; 128 char *q; 129 /* BIG NOTE: this function only does SIDS where the identauth is not >= 2^32 */ 130 uint32_t conv; 131 132 ZERO_STRUCTP(sidout); 133 134 if ((sidstr[0] != 'S' && sidstr[0] != 's') || sidstr[1] != '-') { 135 goto format_error; 136 } 137 138 /* Get the revision number. */ 139 p = sidstr + 2; 140 141 if (!isdigit(*p)) { 142 goto format_error; 143 } 144 145 conv = (uint32_t) strtoul(p, &q, 10); 146 if (!q || (*q != '-')) { 147 goto format_error; 148 } 149 sidout->sid_rev_num = (uint8_t) conv; 150 q++; 151 152 if (!isdigit(*q)) { 153 goto format_error; 154 } 155 156 /* get identauth */ 157 conv = (uint32_t) strtoul(q, &q, 10); 158 if (!q) { 159 goto format_error; 160 } 161 162 /* identauth in decimal should be < 2^32 */ 163 /* NOTE - the conv value is in big-endian format. */ 164 sidout->id_auth[0] = 0; 165 sidout->id_auth[1] = 0; 166 sidout->id_auth[2] = (conv & 0xff000000) >> 24; 167 sidout->id_auth[3] = (conv & 0x00ff0000) >> 16; 168 sidout->id_auth[4] = (conv & 0x0000ff00) >> 8; 169 sidout->id_auth[5] = (conv & 0x000000ff); 170 171 sidout->num_auths = 0; 172 if (*q != '-') { 173 /* Just id_auth, no subauths */ 174 return true; 175 } 176 177 q++; 178 179 while (true) { 180 char *end; 181 182 if (!isdigit(*q)) { 183 goto format_error; 184 } 185 186 conv = strtoul(q, &end, 10); 187 if (end == q) { 188 goto format_error; 189 } 190 191 if (!sid_append_rid(sidout, conv)) { 192 DEBUG(3, ("Too many sid auths in %s\n", sidstr)); 193 return false; 194 } 195 196 q = end; 197 if (*q != '-') { 198 break; 199 } 200 q += 1; 201 } 202 if (endp != NULL) { 203 *endp = q; 204 } 205 return true; 206 207 format_error: 208 DEBUG(3, ("string_to_sid: SID %s is not in a valid format\n", sidstr)); 209 return false; 210 } 211 212 bool string_to_sid(struct dom_sid *sidout, const char *sidstr) 213 { 214 return dom_sid_parse(sidstr, sidout); 215 } 91 216 92 217 bool dom_sid_parse(const char *sidstr, struct dom_sid *ret) 93 218 { 94 uint_t rev, ia, num_sub_auths, i; 95 char *p; 96 97 if (strncasecmp(sidstr, "S-", 2)) { 98 return false; 99 } 100 101 sidstr += 2; 102 103 rev = strtol(sidstr, &p, 10); 104 if (*p != '-') { 105 return false; 106 } 107 sidstr = p+1; 108 109 ia = strtol(sidstr, &p, 10); 110 if (p == sidstr) { 111 return false; 112 } 113 sidstr = p; 114 115 num_sub_auths = 0; 116 for (i=0;sidstr[i];i++) { 117 if (sidstr[i] == '-') num_sub_auths++; 118 } 119 120 if (num_sub_auths > MAXSUBAUTHS) { 121 return false; 122 } 123 124 ret->sid_rev_num = rev; 125 ret->id_auth[0] = 0; 126 ret->id_auth[1] = 0; 127 ret->id_auth[2] = ia >> 24; 128 ret->id_auth[3] = ia >> 16; 129 ret->id_auth[4] = ia >> 8; 130 ret->id_auth[5] = ia; 131 ret->num_auths = num_sub_auths; 132 133 for (i=0;i<num_sub_auths;i++) { 134 if (sidstr[0] != '-') { 135 return false; 136 } 137 sidstr++; 138 ret->sub_auths[i] = strtoul(sidstr, &p, 10); 139 if (p == sidstr) { 140 return false; 141 } 142 sidstr = p; 143 } 144 145 return true; 219 return dom_sid_parse_endp(sidstr, ret, NULL); 146 220 } 147 221 … … 222 296 struct dom_sid *sid; 223 297 224 sid = talloc(mem_ctx, struct dom_sid);298 sid = dom_sid_dup(mem_ctx, domain_sid); 225 299 if (!sid) return NULL; 226 300 227 *sid = *domain_sid;228 229 sid->sub_auths[sid->num_auths] = rid;230 sid->num_auths++;301 if (!sid_append_rid(sid, rid)) { 302 talloc_free(sid); 303 return NULL; 304 } 231 305 232 306 return sid; … … 284 358 285 359 /* 286 convert a dom_sid to a string 287 */ 288 char *dom_sid_string(TALLOC_CTX *mem_ctx, const struct dom_sid *sid) 289 { 290 int i, ofs, maxlen; 360 Convert a dom_sid to a string, printing into a buffer. Return the 361 string length. If it overflows, return the string length that would 362 result (buflen needs to be +1 for the terminating 0). 363 */ 364 int dom_sid_string_buf(const struct dom_sid *sid, char *buf, int buflen) 365 { 366 int i, ofs; 291 367 uint32_t ia; 292 char *ret;293 368 294 369 if (!sid) { 295 return talloc_strdup(mem_ctx, "(NULL SID)"); 296 } 297 298 maxlen = sid->num_auths * 11 + 25; 299 ret = talloc_array(mem_ctx, char, maxlen); 300 if (!ret) return talloc_strdup(mem_ctx, "(SID ERR)"); 370 strlcpy(buf, "(NULL SID)", buflen); 371 return 10; /* strlen("(NULL SID)") */ 372 } 301 373 302 374 ia = (sid->id_auth[5]) + … … 305 377 (sid->id_auth[2] << 24); 306 378 307 ofs = snprintf( ret, maxlen, "S-%u-%lu",379 ofs = snprintf(buf, buflen, "S-%u-%lu", 308 380 (unsigned int)sid->sid_rev_num, (unsigned long)ia); 309 381 310 382 for (i = 0; i < sid->num_auths; i++) { 311 ofs += snprintf( ret + ofs, maxlen - ofs, "-%lu",383 ofs += snprintf(buf + ofs, MAX(buflen - ofs, 0), "-%lu", 312 384 (unsigned long)sid->sub_auths[i]); 313 385 } 314 315 return ret; 316 } 386 return ofs; 387 } 388 389 /* 390 convert a dom_sid to a string 391 */ 392 char *dom_sid_string(TALLOC_CTX *mem_ctx, const struct dom_sid *sid) 393 { 394 char buf[DOM_SID_STR_BUFLEN]; 395 char *result; 396 int len; 397 398 len = dom_sid_string_buf(sid, buf, sizeof(buf)); 399 400 if (len+1 > sizeof(buf)) { 401 return talloc_strdup(mem_ctx, "(SID ERR)"); 402 } 403 404 /* 405 * Avoid calling strlen (via talloc_strdup), we already have 406 * the length 407 */ 408 result = (char *)talloc_memdup(mem_ctx, buf, len+1); 409 410 /* 411 * beautify the talloc_report output 412 */ 413 talloc_set_name_const(result, result); 414 return result; 415 } -
vendor/current/libcli/security/dom_sid.h
r581 r740 26 26 #include "librpc/gen_ndr/security.h" 27 27 28 /* Some well-known SIDs */ 29 extern const struct dom_sid global_sid_World_Domain; 30 extern const struct dom_sid global_sid_World; 31 extern const struct dom_sid global_sid_Creator_Owner_Domain; 32 extern const struct dom_sid global_sid_NT_Authority; 33 extern const struct dom_sid global_sid_Enterprise_DCs; 34 extern const struct dom_sid global_sid_System; 35 extern const struct dom_sid global_sid_NULL; 36 extern const struct dom_sid global_sid_Authenticated_Users; 37 extern const struct dom_sid global_sid_Network; 38 extern const struct dom_sid global_sid_Creator_Owner; 39 extern const struct dom_sid global_sid_Creator_Group; 40 extern const struct dom_sid global_sid_Anonymous; 41 extern const struct dom_sid global_sid_Builtin; 42 extern const struct dom_sid global_sid_Builtin_Administrators; 43 extern const struct dom_sid global_sid_Builtin_Users; 44 extern const struct dom_sid global_sid_Builtin_Guests; 45 extern const struct dom_sid global_sid_Builtin_Power_Users; 46 extern const struct dom_sid global_sid_Builtin_Account_Operators; 47 extern const struct dom_sid global_sid_Builtin_Server_Operators; 48 extern const struct dom_sid global_sid_Builtin_Print_Operators; 49 extern const struct dom_sid global_sid_Builtin_Backup_Operators; 50 extern const struct dom_sid global_sid_Builtin_Replicator; 51 extern const struct dom_sid global_sid_Builtin_PreWin2kAccess; 52 extern const struct dom_sid global_sid_Unix_Users; 53 extern const struct dom_sid global_sid_Unix_Groups; 54 55 int dom_sid_compare_auth(const struct dom_sid *sid1, 56 const struct dom_sid *sid2); 28 57 int dom_sid_compare(const struct dom_sid *sid1, const struct dom_sid *sid2); 58 int dom_sid_compare_domain(const struct dom_sid *sid1, 59 const struct dom_sid *sid2); 29 60 bool dom_sid_equal(const struct dom_sid *sid1, const struct dom_sid *sid2); 61 bool sid_append_rid(struct dom_sid *sid, uint32_t rid); 62 bool string_to_sid(struct dom_sid *sidout, const char *sidstr); 63 bool dom_sid_parse_endp(const char *sidstr,struct dom_sid *sidout, 64 const char **endp); 30 65 bool dom_sid_parse(const char *sidstr, struct dom_sid *ret); 31 66 struct dom_sid *dom_sid_parse_talloc(TALLOC_CTX *mem_ctx, const char *sidstr); … … 39 74 bool dom_sid_in_domain(const struct dom_sid *domain_sid, 40 75 const struct dom_sid *sid); 76 77 #define DOM_SID_STR_BUFLEN (15*11+25) 78 int dom_sid_string_buf(const struct dom_sid *sid, char *buf, int buflen); 41 79 char *dom_sid_string(TALLOC_CTX *mem_ctx, const struct dom_sid *sid); 42 80 43 #ifndef MAXSUBAUTHS 44 #define MAXSUBAUTHS 15 /* max sub authorities in a SID */ 45 #endif 81 82 const char *sid_type_lookup(uint32_t sid_type); 83 const struct security_token *get_system_token(void); 84 bool sid_compose(struct dom_sid *dst, const struct dom_sid *domain_sid, uint32_t rid); 85 bool sid_split_rid(struct dom_sid *sid, uint32_t *rid); 86 bool sid_peek_rid(const struct dom_sid *sid, uint32_t *rid); 87 bool sid_peek_check_rid(const struct dom_sid *exp_dom_sid, const struct dom_sid *sid, uint32_t *rid); 88 void sid_copy(struct dom_sid *dst, const struct dom_sid *src); 89 bool sid_blob_parse(DATA_BLOB in, struct dom_sid *sid); 90 bool sid_parse(const char *inbuf, size_t len, struct dom_sid *sid); 91 int sid_compare_domain(const struct dom_sid *sid1, const struct dom_sid *sid2); 92 bool sid_equal(const struct dom_sid *sid1, const struct dom_sid *sid2); 93 NTSTATUS add_sid_to_array(TALLOC_CTX *mem_ctx, const struct dom_sid *sid, 94 struct dom_sid **sids, uint32_t *num); 95 NTSTATUS add_sid_to_array_unique(TALLOC_CTX *mem_ctx, const struct dom_sid *sid, 96 struct dom_sid **sids, uint32_t *num_sids); 97 void del_sid_from_array(const struct dom_sid *sid, struct dom_sid **sids, 98 uint32_t *num); 99 bool add_rid_to_array_unique(TALLOC_CTX *mem_ctx, 100 uint32_t rid, uint32_t **pp_rids, size_t *p_num); 101 bool is_null_sid(const struct dom_sid *sid); 46 102 47 103 #endif /*_DOM_SID_H_*/ -
vendor/current/libcli/security/secace.c
r414 r740 23 23 #include "includes.h" 24 24 #include "librpc/gen_ndr/ndr_security.h" 25 #include "libcli/security/dom_sid.h" 25 #include "libcli/security/security.h" 26 #include "lib/util/tsort.h" 26 27 27 28 #define SEC_ACE_HEADER_SIZE (2 * sizeof(uint8_t) + sizeof(uint16_t) + sizeof(uint32_t)) … … 44 45 * copy a struct security_ace structure. 45 46 */ 46 void sec_ace_copy(struct security_ace *ace_dest, struct security_ace *ace_src)47 void sec_ace_copy(struct security_ace *ace_dest, const struct security_ace *ace_src) 47 48 { 48 49 ace_dest->type = ace_src->type; … … 63 64 t->type = type; 64 65 t->flags = flag; 65 t->size = ndr_size_dom_sid(sid, NULL,0) + 8;66 t->size = ndr_size_dom_sid(sid, 0) + 8; 66 67 t->access_mask = mask; 67 68 … … 73 74 ********************************************************************/ 74 75 75 NTSTATUS sec_ace_add_sid(TALLOC_CTX *ctx, struct security_ace **pp_new, struct security_ace *old, unsigned *num, struct dom_sid *sid, uint32_t mask)76 NTSTATUS sec_ace_add_sid(TALLOC_CTX *ctx, struct security_ace **pp_new, struct security_ace *old, unsigned *num, const struct dom_sid *sid, uint32_t mask) 76 77 { 77 78 unsigned int i = 0; … … 89 90 (*pp_new)[i].type = SEC_ACE_TYPE_ACCESS_ALLOWED; 90 91 (*pp_new)[i].flags = 0; 91 (*pp_new)[i].size = SEC_ACE_HEADER_SIZE + ndr_size_dom_sid(sid, NULL,0);92 (*pp_new)[i].size = SEC_ACE_HEADER_SIZE + ndr_size_dom_sid(sid, 0); 92 93 (*pp_new)[i].access_mask = mask; 93 94 (*pp_new)[i].trustee = *sid; … … 99 100 ********************************************************************/ 100 101 101 NTSTATUS sec_ace_mod_sid(struct security_ace *ace, size_t num, struct dom_sid *sid, uint32_t mask)102 NTSTATUS sec_ace_mod_sid(struct security_ace *ace, size_t num, const struct dom_sid *sid, uint32_t mask) 102 103 { 103 104 unsigned int i = 0; … … 118 119 ********************************************************************/ 119 120 120 NTSTATUS sec_ace_del_sid(TALLOC_CTX *ctx, struct security_ace **pp_new, struct security_ace *old, uint32_t *num, struct dom_sid *sid)121 NTSTATUS sec_ace_del_sid(TALLOC_CTX *ctx, struct security_ace **pp_new, struct security_ace *old, uint32_t *num, const struct dom_sid *sid) 121 122 { 122 123 unsigned int i = 0; … … 150 151 ********************************************************************/ 151 152 152 bool sec_ace_equal( struct security_ace *s1,struct security_ace *s2)153 bool sec_ace_equal(const struct security_ace *s1, const struct security_ace *s2) 153 154 { 154 155 /* Trivial case */ … … 178 179 } 179 180 180 int nt_ace_inherit_comp( struct security_ace *a1,struct security_ace *a2)181 int nt_ace_inherit_comp(const struct security_ace *a1, const struct security_ace *a2) 181 182 { 182 183 int a1_inh = a1->flags & SEC_ACE_FLAG_INHERITED_ACE; … … 195 196 *******************************************************************/ 196 197 197 int nt_ace_canon_comp( struct security_ace *a1,struct security_ace *a2)198 int nt_ace_canon_comp( const struct security_ace *a1, const struct security_ace *a2) 198 199 { 199 200 if ((a1->type == SEC_ACE_TYPE_ACCESS_DENIED) && … … 258 259 259 260 /* Sort so that non-inherited ACE's come first. */ 260 qsort( srclist, num_aces, sizeof(srclist[0]), QSORT_CASTnt_ace_inherit_comp);261 TYPESAFE_QSORT(srclist, num_aces, nt_ace_inherit_comp); 261 262 262 263 /* Find the boundary between non-inherited ACEs. */ … … 271 272 272 273 /* Sort the non-inherited ACEs. */ 273 if (i) 274 qsort( srclist, i, sizeof(srclist[0]), QSORT_CAST nt_ace_canon_comp); 274 TYPESAFE_QSORT(srclist, i, nt_ace_canon_comp); 275 275 276 276 /* Now sort the inherited ACEs. */ 277 if (num_aces - i) 278 qsort( &srclist[i], num_aces - i, sizeof(srclist[0]), QSORT_CAST nt_ace_canon_comp); 279 } 280 281 277 TYPESAFE_QSORT(&srclist[i], num_aces - i, nt_ace_canon_comp); 278 } 279 280 -
vendor/current/libcli/security/secace.h
r414 r740 25 25 26 26 bool sec_ace_object(uint8_t type); 27 void sec_ace_copy(struct security_ace *ace_dest, struct security_ace *ace_src);27 void sec_ace_copy(struct security_ace *ace_dest, const struct security_ace *ace_src); 28 28 void init_sec_ace(struct security_ace *t, const struct dom_sid *sid, enum security_ace_type type, 29 29 uint32_t mask, uint8_t flag); 30 NTSTATUS sec_ace_add_sid(TALLOC_CTX *ctx, struct security_ace **pp_new, struct security_ace *old, unsigned *num, struct dom_sid *sid, uint32_t mask);31 NTSTATUS sec_ace_mod_sid(struct security_ace *ace, size_t num, struct dom_sid *sid, uint32_t mask);32 NTSTATUS sec_ace_del_sid(TALLOC_CTX *ctx, struct security_ace **pp_new, struct security_ace *old, uint32_t *num, struct dom_sid *sid);33 bool sec_ace_equal( struct security_ace *s1,struct security_ace *s2);34 int nt_ace_inherit_comp( struct security_ace *a1,struct security_ace *a2);35 int nt_ace_canon_comp( struct security_ace *a1,struct security_ace *a2);30 NTSTATUS sec_ace_add_sid(TALLOC_CTX *ctx, struct security_ace **pp_new, struct security_ace *old, unsigned *num, const struct dom_sid *sid, uint32_t mask); 31 NTSTATUS sec_ace_mod_sid(struct security_ace *ace, size_t num, const struct dom_sid *sid, uint32_t mask); 32 NTSTATUS sec_ace_del_sid(TALLOC_CTX *ctx, struct security_ace **pp_new, struct security_ace *old, uint32_t *num, const struct dom_sid *sid); 33 bool sec_ace_equal(const struct security_ace *s1, const struct security_ace *s2); 34 int nt_ace_inherit_comp( const struct security_ace *a1, const struct security_ace *a2); 35 int nt_ace_canon_comp( const struct security_ace *a1, const struct security_ace *a2); 36 36 void dacl_sort_into_canonical_order(struct security_ace *srclist, unsigned int num_aces); 37 37 -
vendor/current/libcli/security/secacl.c
r414 r740 24 24 #include "librpc/gen_ndr/ndr_security.h" 25 25 #include "libcli/security/secace.h" 26 #include "libcli/security/secacl.h" 26 27 27 28 #define SEC_ACL_HEADER_SIZE (2 * sizeof(uint16_t) + sizeof(uint32_t)) … … 76 77 return make_sec_acl(ctx, src->revision, src->num_aces, src->aces); 77 78 } 78 79 /*******************************************************************80 Compares two SEC_ACL structures81 ********************************************************************/82 83 bool sec_acl_equal(struct security_acl *s1, struct security_acl *s2)84 {85 unsigned int i, j;86 87 /* Trivial cases */88 89 if (!s1 && !s2) return true;90 if (!s1 || !s2) return false;91 92 /* Check top level stuff */93 94 if (s1->revision != s2->revision) {95 DEBUG(10, ("sec_acl_equal(): revision differs (%d != %d)\n",96 s1->revision, s2->revision));97 return false;98 }99 100 if (s1->num_aces != s2->num_aces) {101 DEBUG(10, ("sec_acl_equal(): num_aces differs (%d != %d)\n",102 s1->revision, s2->revision));103 return false;104 }105 106 /* The ACEs could be in any order so check each ACE in s1 against107 each ACE in s2. */108 109 for (i = 0; i < s1->num_aces; i++) {110 bool found = false;111 112 for (j = 0; j < s2->num_aces; j++) {113 if (sec_ace_equal(&s1->aces[i], &s2->aces[j])) {114 found = true;115 break;116 }117 }118 119 if (!found) return false;120 }121 122 return true;123 } -
vendor/current/libcli/security/secacl.h
r414 r740 27 27 int num_aces, struct security_ace *ace_list); 28 28 struct security_acl *dup_sec_acl(TALLOC_CTX *ctx, struct security_acl *src); 29 bool sec_acl_equal(struct security_acl *s1, struct security_acl *s2);30 29 31 30 -
vendor/current/libcli/security/security_descriptor.c
r414 r740 21 21 22 22 #include "includes.h" 23 #include "libcli/security/security_descriptor.h" 24 #include "libcli/security/dom_sid.h" 23 #include "libcli/security/security.h" 25 24 26 25 /* … … 56 55 struct security_acl *nacl; 57 56 57 if (oacl == NULL) { 58 return NULL; 59 } 60 58 61 nacl = talloc (mem_ctx, struct security_acl); 59 62 if (nacl == NULL) { … … 83 86 { 84 87 struct security_acl *nacl; 85 int i;88 uint32_t i; 86 89 87 90 if (!acl1 && !acl2) … … 268 271 const struct dom_sid *trustee) 269 272 { 270 int i;273 uint32_t i; 271 274 bool found = false; 272 275 struct security_acl *acl = NULL; … … 362 365 const struct security_acl *acl2) 363 366 { 364 int i;367 uint32_t i; 365 368 366 369 if (acl1 == acl2) return true; -
vendor/current/libcli/security/security_descriptor.h
r414 r740 69 69 const struct security_acl *acl2); 70 70 71 uint32_t map_generic_rights_ds(uint32_t access_mask); 72 73 struct security_descriptor *create_security_descriptor(TALLOC_CTX *mem_ctx, 74 struct security_descriptor *parent_sd, 75 struct security_descriptor *creator_sd, 76 bool is_container, 77 struct GUID *object_list, 78 uint32_t inherit_flags, 79 struct security_token *token, 80 struct dom_sid *default_owner, /* valid only for DS, NULL for the other RSs */ 81 struct dom_sid *default_group, /* valid only for DS, NULL for the other RSs */ 82 uint32_t (*generic_map)(uint32_t access_mask)); 83 71 84 #endif /* __SECURITY_DESCRIPTOR_H__ */ -
vendor/current/libcli/smb/smb2_constants.h
r414 r740 29 29 #define SMB2_HDR_STATUS 0x08 30 30 #define SMB2_HDR_OPCODE 0x0c 31 #define SMB2_HDR_CREDIT 31 #define SMB2_HDR_CREDIT 0x0e 32 32 #define SMB2_HDR_FLAGS 0x10 33 33 #define SMB2_HDR_NEXT_COMMAND 0x14 … … 38 38 #define SMB2_HDR_SIGNATURE 0x30 /* 16 bytes */ 39 39 #define SMB2_HDR_BODY 0x40 40 41 /* offsets into header elements for an async SMB2 request */ 42 #define SMB2_HDR_ASYNC_ID 0x20 40 43 41 44 /* header flags */ … … 82 85 #define SMB2_CAP_DFS 0x00000001 83 86 #define SMB2_CAP_LEASING 0x00000002 /* only in dialect 0x210 */ 87 #define SMB2_CAP_LARGE_MTU 0x00000004 /* only in dialect 0x210 */ 84 88 /* so we can spot new caps as added */ 85 89 #define SMB2_CAP_ALL SMB2_CAP_DFS … … 88 92 #define SMB2_SESSION_FLAG_IS_GUEST 0x0001 89 93 #define SMB2_SESSION_FLAG_IS_NULL 0x0002 94 95 /* SMB2 sharetype flags */ 96 #define SMB2_SHARE_TYPE_DISK 0x1 97 #define SMB2_SHARE_TYPE_PIPE 0x2 98 #define SMB2_SHARE_TYPE_PRINT 0x3 90 99 91 100 /* SMB2 share flags */ … … 101 110 #define SMB2_SHAREFLAG_ACCESS_BASED_DIRECTORY_ENUM 0x0800 102 111 #define SMB2_SHAREFLAG_ALL 0x0F33 112 113 /* SMB2 share capafilities */ 114 #define SMB2_SHARE_CAP_DFS 0x8 103 115 104 116 /* SMB2 create security flags */ … … 173 185 #define SMB2_GETINFO_QUOTA 0x04 174 186 187 #define SMB2_CLOSE_FLAGS_FULL_INFORMATION (0x01) 188 175 189 #endif -
vendor/current/libcli/util/doserr.c
r414 r740 127 127 { "WERR_DS_PROTOCOL_ERROR", WERR_DS_PROTOCOL_ERROR }, 128 128 { "WERR_DS_TIMELIMIT_EXCEEEDED", WERR_DS_TIMELIMIT_EXCEEDED }, 129 { "WERR_DS_SIZE_LIMIT_EXCEEDED", WERR_DS_SIZE_LIMIT_EXCEEDED },130 129 { "WERR_DS_ADMIN_LIMIT_EXCEEEDED", WERR_DS_ADMIN_LIMIT_EXCEEDED }, 131 130 { "WERR_DS_COMPARE_FALSE", WERR_DS_COMPARE_FALSE }, … … 166 165 { "WERR_DS_DRA_SOURCE_DISABLED", WERR_DS_DRA_SOURCE_DISABLED }, 167 166 { "WERR_DS_DNS_LOOKUP_FAILURE", WERR_DS_DNS_LOOKUP_FAILURE }, 168 { "WERR_DS_WRONG_LINKED_ATTRIBUTE_SYNTAX", WERR_DS_WRONG_LINKED_ATTRIBUTE_SYNTAX },169 167 { "WERR_DS_NO_MSDS_INTID", WERR_DS_NO_MSDS_INTID }, 170 168 { "WERR_DS_DUP_MSDS_INTID", WERR_DS_DUP_MSDS_INTID }, 169 { "WERR_DNS_ERROR_RCODE_FORMAT_ERROR", WERR_DNS_ERROR_RCODE_FORMAT_ERROR }, 170 { "WERR_DNS_ERROR_RCODE_SERVER_FAILURE", WERR_DNS_ERROR_RCODE_SERVER_FAILURE }, 171 { "WERR_DNS_ERROR_RCODE_NAME_ERROR", WERR_DNS_ERROR_RCODE_NAME_ERROR }, 172 { "WERR_DNS_ERROR_RCODE_NOT_IMPLEMENTED", WERR_DNS_ERROR_RCODE_NOT_IMPLEMENTED }, 173 { "WERR_DNS_ERROR_RCODE_REFUSED", WERR_DNS_ERROR_RCODE_REFUSED }, 174 { "WERR_DNS_ERROR_RCODE_YXDOMAIN", WERR_DNS_ERROR_RCODE_YXDOMAIN }, 175 { "WERR_DNS_ERROR_RCODE_YXRRSET", WERR_DNS_ERROR_RCODE_YXRRSET }, 176 { "WERR_DNS_ERROR_RCODE_NXRRSET", WERR_DNS_ERROR_RCODE_NXRRSET }, 177 { "WERR_DNS_ERROR_RCODE_NOTAUTH", WERR_DNS_ERROR_RCODE_NOTAUTH }, 178 { "WERR_DNS_ERROR_RCODE_NOTZONE", WERR_DNS_ERROR_RCODE_NOTZONE }, 179 { "WERR_DNS_ERROR_RCODE_BADSIG", WERR_DNS_ERROR_RCODE_BADSIG }, 180 { "WERR_DNS_ERROR_RCODE_BADKEY", WERR_DNS_ERROR_RCODE_BADKEY }, 181 { "WERR_DNS_ERROR_RCODE_BADTIME", WERR_DNS_ERROR_RCODE_BADTIME }, 182 { "WERR_DNS_INFO_NO_RECORDS", WERR_DNS_INFO_NO_RECORDS }, 183 { "WERR_DNS_ERROR_BAD_PACKET", WERR_DNS_ERROR_BAD_PACKET }, 184 { "WERR_DNS_ERROR_NO_PACKET", WERR_DNS_ERROR_NO_PACKET }, 185 { "WERR_DNS_ERROR_RCODE", WERR_DNS_ERROR_RCODE }, 186 { "WERR_DNS_ERROR_UNSECURE_PACKET", WERR_DNS_ERROR_UNSECURE_PACKET }, 187 { "WERR_DNS_ERROR_INVALID_TYPE", WERR_DNS_ERROR_INVALID_TYPE }, 188 { "WERR_DNS_ERROR_INVALID_IP_ADDRESS", WERR_DNS_ERROR_INVALID_IP_ADDRESS }, 189 { "WERR_DNS_ERROR_INVALID_PROPERTY", WERR_DNS_ERROR_INVALID_PROPERTY }, 190 { "WERR_DNS_ERROR_TRY_AGAIN_LATER", WERR_DNS_ERROR_TRY_AGAIN_LATER }, 191 { "WERR_DNS_ERROR_NOT_UNIQUE", WERR_DNS_ERROR_NOT_UNIQUE }, 192 { "WERR_DNS_ERROR_NON_RFC_NAME", WERR_DNS_ERROR_NON_RFC_NAME }, 193 { "WERR_DNS_STATUS_FQDN", WERR_DNS_STATUS_FQDN }, 194 { "WERR_DNS_STATUS_DOTTED_NAME", WERR_DNS_STATUS_DOTTED_NAME }, 195 { "WERR_DNS_STATUS_SINGLE_PART_NAME", WERR_DNS_STATUS_SINGLE_PART_NAME }, 196 { "WERR_DNS_ERROR_INVALID_NAME_CHAR", WERR_DNS_ERROR_INVALID_NAME_CHAR }, 197 { "WERR_DNS_ERROR_NUMERIC_NAME", WERR_DNS_ERROR_NUMERIC_NAME }, 198 { "WERR_DNS_ERROR_NOT_ALLOWED_ON_ROOT_SERVER", WERR_DNS_ERROR_NOT_ALLOWED_ON_ROOT_SERVER }, 199 { "WERR_DNS_ERROR_NOT_ALLOWED_UNDER_DELEGATION", WERR_DNS_ERROR_NOT_ALLOWED_UNDER_DELEGATION }, 200 { "WERR_DNS_ERROR_CANNOT_FIND_ROOT_HINTS", WERR_DNS_ERROR_CANNOT_FIND_ROOT_HINTS }, 201 { "WERR_DNS_ERROR_INCONSISTENT_ROOT_HINTS", WERR_DNS_ERROR_INCONSISTENT_ROOT_HINTS }, 202 { "WERR_DNS_ERROR_DWORD_VALUE_TOO_SMALL", WERR_DNS_ERROR_DWORD_VALUE_TOO_SMALL }, 203 { "WERR_DNS_ERROR_DWORD_VALUE_TOO_LARGE", WERR_DNS_ERROR_DWORD_VALUE_TOO_LARGE }, 204 { "WERR_DNS_ERROR_BACKGROUND_LOADING", WERR_DNS_ERROR_BACKGROUND_LOADING }, 205 { "WERR_DNS_ERROR_NOT_ALLOWED_ON_RODC", WERR_DNS_ERROR_NOT_ALLOWED_ON_RODC }, 206 { "WERR_DNS_ERROR_ZONE_DOES_NOT_EXIST", WERR_DNS_ERROR_ZONE_DOES_NOT_EXIST }, 207 { "WERR_DNS_ERROR_NO_ZONE_INFO", WERR_DNS_ERROR_NO_ZONE_INFO }, 208 { "WERR_DNS_ERROR_INVALID_ZONE_OPERATION", WERR_DNS_ERROR_INVALID_ZONE_OPERATION }, 209 { "WERR_DNS_ERROR_ZONE_CONFIGURATION_ERROR", WERR_DNS_ERROR_ZONE_CONFIGURATION_ERROR }, 210 { "WERR_DNS_ERROR_ZONE_HAS_NO_SOA_RECORD", WERR_DNS_ERROR_ZONE_HAS_NO_SOA_RECORD }, 211 { "WERR_DNS_ERROR_ZONE_HAS_NO_NS_RECORDS", WERR_DNS_ERROR_ZONE_HAS_NO_NS_RECORDS }, 212 { "WERR_DNS_ERROR_ZONE_LOCKED", WERR_DNS_ERROR_ZONE_LOCKED }, 213 { "WERR_DNS_ERROR_ZONE_CREATION_FAILED", WERR_DNS_ERROR_ZONE_CREATION_FAILED }, 214 { "WERR_DNS_ERROR_ZONE_ALREADY_EXISTS", WERR_DNS_ERROR_ZONE_ALREADY_EXISTS }, 215 { "WERR_DNS_ERROR_AUTOZONE_ALREADY_EXISTS", WERR_DNS_ERROR_AUTOZONE_ALREADY_EXISTS }, 216 { "WERR_DNS_ERROR_INVALID_ZONE_TYPE", WERR_DNS_ERROR_INVALID_ZONE_TYPE }, 217 { "WERR_DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP", WERR_DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP }, 218 { "WERR_DNS_ERROR_ZONE_NOT_SECONDARY", WERR_DNS_ERROR_ZONE_NOT_SECONDARY }, 219 { "WERR_DNS_ERROR_NEED_SECONDARY_ADDRESSES", WERR_DNS_ERROR_NEED_SECONDARY_ADDRESSES }, 220 { "WERR_DNS_ERROR_WINS_INIT_FAILED", WERR_DNS_ERROR_WINS_INIT_FAILED }, 221 { "WERR_DNS_ERROR_NEED_WINS_SERVERS", WERR_DNS_ERROR_NEED_WINS_SERVERS }, 222 { "WERR_DNS_ERROR_NBSTAT_INIT_FAILED", WERR_DNS_ERROR_NBSTAT_INIT_FAILED }, 223 { "WERR_DNS_ERROR_SOA_DELETE_INVALID", WERR_DNS_ERROR_SOA_DELETE_INVALID }, 224 { "WERR_DNS_ERROR_FORWARDER_ALREADY_EXISTS", WERR_DNS_ERROR_FORWARDER_ALREADY_EXISTS }, 225 { "WERR_DNS_ERROR_ZONE_REQUIRES_MASTER_IP", WERR_DNS_ERROR_ZONE_REQUIRES_MASTER_IP }, 226 { "WERR_DNS_ERROR_ZONE_IS_SHUTDOWN", WERR_DNS_ERROR_ZONE_IS_SHUTDOWN }, 227 { "WERR_DNS_ERROR_PRIMARY_REQUIRES_DATAFILE", WERR_DNS_ERROR_PRIMARY_REQUIRES_DATAFILE }, 228 { "WERR_DNS_ERROR_INVALID_DATAFILE_NAME", WERR_DNS_ERROR_INVALID_DATAFILE_NAME }, 229 { "WERR_DNS_ERROR_DATAFILE_OPEN_FAILURE", WERR_DNS_ERROR_DATAFILE_OPEN_FAILURE }, 230 { "WERR_DNS_ERROR_FILE_WRITEBACK_FAILED", WERR_DNS_ERROR_FILE_WRITEBACK_FAILED }, 231 { "WERR_DNS_ERROR_DATAFILE_PARSING", WERR_DNS_ERROR_DATAFILE_PARSING }, 232 { "WERR_DNS_ERROR_RECORD_DOES_NOT_EXIST", WERR_DNS_ERROR_RECORD_DOES_NOT_EXIST }, 233 { "WERR_DNS_ERROR_RECORD_FORMAT", WERR_DNS_ERROR_RECORD_FORMAT }, 234 { "WERR_DNS_ERROR_NODE_CREATION_FAILED", WERR_DNS_ERROR_NODE_CREATION_FAILED }, 235 { "WERR_DNS_ERROR_UNKNOWN_RECORD_TYPE", WERR_DNS_ERROR_UNKNOWN_RECORD_TYPE }, 236 { "WERR_DNS_ERROR_RECORD_TIMED_OUT", WERR_DNS_ERROR_RECORD_TIMED_OUT }, 237 { "WERR_DNS_ERROR_NAME_NOT_IN_ZONE", WERR_DNS_ERROR_NAME_NOT_IN_ZONE }, 238 { "WERR_DNS_ERROR_CNAME_LOOP", WERR_DNS_ERROR_CNAME_LOOP }, 239 { "WERR_DNS_ERROR_NODE_IS_CNAME", WERR_DNS_ERROR_NODE_IS_CNAME }, 240 { "WERR_DNS_ERROR_CNAME_COLLISION", WERR_DNS_ERROR_CNAME_COLLISION }, 241 { "WERR_DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT", WERR_DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT }, 242 { "WERR_DNS_ERROR_RECORD_ALREADY_EXISTS", WERR_DNS_ERROR_RECORD_ALREADY_EXISTS }, 243 { "WERR_DNS_ERROR_SECONDARY_DATA", WERR_DNS_ERROR_SECONDARY_DATA }, 244 { "WERR_DNS_ERROR_NO_CREATE_CACHE_DATA", WERR_DNS_ERROR_NO_CREATE_CACHE_DATA }, 245 { "WERR_DNS_ERROR_NAME_DOES_NOT_EXIST", WERR_DNS_ERROR_NAME_DOES_NOT_EXIST }, 246 { "WERR_DNS_WARNING_PTR_CREATE_FAILED", WERR_DNS_WARNING_PTR_CREATE_FAILED }, 247 { "WERR_DNS_WARNING_DOMAIN_UNDELETED", WERR_DNS_WARNING_DOMAIN_UNDELETED }, 248 { "WERR_DNS_ERROR_DS_UNAVAILABLE", WERR_DNS_ERROR_DS_UNAVAILABLE }, 249 { "WERR_DNS_ERROR_DS_ZONE_ALREADY_EXISTS", WERR_DNS_ERROR_DS_ZONE_ALREADY_EXISTS }, 250 { "WERR_DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE", WERR_DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE }, 251 { "WERR_DNS_INFO_AXFR_COMPLETE", WERR_DNS_INFO_AXFR_COMPLETE }, 252 { "WERR_DNS_ERROR_AXFR", WERR_DNS_ERROR_AXFR }, 253 { "WERR_DNS_INFO_ADDED_LOCAL_WINS", WERR_DNS_INFO_ADDED_LOCAL_WINS }, 254 { "WERR_DNS_STATUS_CONTINUE_NEEDED", WERR_DNS_STATUS_CONTINUE_NEEDED }, 255 { "WERR_DNS_ERROR_NO_TCPIP", WERR_DNS_ERROR_NO_TCPIP }, 256 { "WERR_DNS_ERROR_NO_DNS_SERVERS", WERR_DNS_ERROR_NO_DNS_SERVERS }, 257 { "WERR_DNS_ERROR_DP_DOES_NOT_EXIST", WERR_DNS_ERROR_DP_DOES_NOT_EXIST }, 258 { "WERR_DNS_ERROR_DP_ALREADY_EXISTS", WERR_DNS_ERROR_DP_ALREADY_EXISTS }, 259 { "WERR_DNS_ERROR_DP_NOT_ENLISTED", WERR_DNS_ERROR_DP_NOT_ENLISTED }, 260 { "WERR_DNS_ERROR_DP_ALREADY_ENLISTED", WERR_DNS_ERROR_DP_ALREADY_ENLISTED }, 261 { "WERR_DNS_ERROR_DP_NOT_AVAILABLE", WERR_DNS_ERROR_DP_NOT_AVAILABLE }, 262 { "WERR_DNS_ERROR_DP_FSMO_ERROR", WERR_DNS_ERROR_DP_FSMO_ERROR }, 171 263 { "WERR_GENERAL_FAILURE", WERR_GENERAL_FAILURE }, 172 264 { "WERR_PRINTQ_FULL", WERR_PRINTQ_FULL }, … … 1963 2055 { "WERR_DS_NOT_INSTALLED", WERR_DS_NOT_INSTALLED }, 1964 2056 { "WERR_DS_MEMBERSHIP_EVALUATED_LOCALLY", WERR_DS_MEMBERSHIP_EVALUATED_LOCALLY }, 1965 { "WERR_DS_INVALID_ATTRIBUTE_YNTAX", WERR_DS_INVALID_ATTRIBUTE_YNTAX },1966 2057 { "WERR_DS_NO_RIDS_ALLOCATED", WERR_DS_NO_RIDS_ALLOCATED }, 1967 2058 { "WERR_DS_NO_MORE_RIDS", WERR_DS_NO_MORE_RIDS }, … … 3259 3350 { WERR_CONNECTION_INVALID, "An operation was attempted on a nonexistent network connection." }, 3260 3351 { WERR_CONNECTION_ACTIVE, "An invalid operation was attempted on an active network connection." }, 3261 { WERR_NETWORK_UNREACHABLE, "The network location cannot be reached. For information about network troubleshooting, see Windows Help." },3262 { WERR_HOST_UNREACHABLE, "The network location cannot be reached. For information about network troubleshooting, see Windows Help." },3263 { WERR_PROTOCOL_UNREACHABLE, "The network location cannot be reached. For information about network troubleshooting, see Windows Help." },3352 { WERR_NETWORK_UNREACHABLE, "The network location cannot be reached." }, 3353 { WERR_HOST_UNREACHABLE, "The network location cannot be reached." }, 3354 { WERR_PROTOCOL_UNREACHABLE, "The network location cannot be reached." }, 3264 3355 { WERR_PORT_UNREACHABLE, "No service is operating at the destination network endpoint on the remote system." }, 3265 3356 { WERR_REQUEST_ABORTED, "The request was aborted." }, … … 3284 3375 { WERR_NOT_SUPPORTED_ON_SBS, "This operation is not supported on a computer running Windows Server 2003 for Small Business Server." }, 3285 3376 { WERR_SERVER_SHUTDOWN_IN_PROGRESS, "The server machine is shutting down." }, 3286 { WERR_HOST_DOWN, "The remote system is not available. For information about network troubleshooting, see Windows Help." },3377 { WERR_HOST_DOWN, "The remote system is not available." }, 3287 3378 { WERR_NON_ACCOUNT_SID, "The security identifier provided is not from an account domain." }, 3288 3379 { WERR_NON_DOMAIN_SID, "The security identifier provided does not have a domain component." }, … … 4474 4565 { WERR_DS_MEMBERSHIP_EVALUATED_LOCALLY, "The directory service evaluated group memberships locally." }, 4475 4566 { WERR_DS_NO_ATTRIBUTE_OR_VALUE, "The specified directory service attribute or value does not exist." }, 4476 { WERR_DS_INVALID_ATTRIBUTE_ YNTAX, "The attribute syntax specified to the directory service is invalid." },4567 { WERR_DS_INVALID_ATTRIBUTE_SYNTAX, "The attribute syntax specified to the directory service is invalid." }, 4477 4568 { WERR_DS_ATTRIBUTE_TYPE_UNDEFINED, "The attribute type specified to the directory service is not defined." }, 4478 4569 { WERR_DS_ATTRIBUTE_OR_VALUE_EXISTS, "The specified directory service attribute or value already exists." }, … … 4854 4945 { WERR_DS_INVALID_SEARCH_FLAG_SUBTREE, "The search flags for the attribute are invalid. The subtree index bit is valid only on single-valued attributes." }, 4855 4946 { WERR_DS_INVALID_SEARCH_FLAG_TUPLE, "The search flags for the attribute are invalid. The tuple index bit is valid only on attributes of Unicode strings." }, 4947 { WERR_DNS_ERROR_RCODE_FORMAT_ERROR, "DNS server unable to interpret format." }, 4948 { WERR_DNS_ERROR_RCODE_SERVER_FAILURE, "DNS server failure." }, 4949 { WERR_DNS_ERROR_RCODE_NAME_ERROR, "DNS name does not exist." }, 4950 { WERR_DNS_ERROR_RCODE_NOT_IMPLEMENTED, "DNS request not supported by name server." }, 4951 { WERR_DNS_ERROR_RCODE_REFUSED, "DNS operation refused." }, 4952 { WERR_DNS_ERROR_RCODE_YXDOMAIN, "DNS name that should not exist, does exist." }, 4953 { WERR_DNS_ERROR_RCODE_YXRRSET, "DNS resource record (RR) set that should not exist, does exist." }, 4954 { WERR_DNS_ERROR_RCODE_NXRRSET, "DNS RR set that should to exist, does not exist." }, 4955 { WERR_DNS_ERROR_RCODE_NOTAUTH, "DNS server not authoritative for zone." }, 4956 { WERR_DNS_ERROR_RCODE_NOTZONE, "DNS name in update or prereq is not in zone." }, 4957 { WERR_DNS_ERROR_RCODE_BADSIG, "DNS signature failed to verify." }, 4958 { WERR_DNS_ERROR_RCODE_BADKEY, "DNS bad key." }, 4959 { WERR_DNS_ERROR_RCODE_BADTIME, "DNS signature validity expired." }, 4960 { WERR_DNS_INFO_NO_RECORDS, "No records found for given DNS query." }, 4961 { WERR_DNS_ERROR_BAD_PACKET, "Bad DNS packet." }, 4962 { WERR_DNS_ERROR_NO_PACKET, "No DNS packet." }, 4963 { WERR_DNS_ERROR_RCODE, "DNS error, check rcode." }, 4964 { WERR_DNS_ERROR_UNSECURE_PACKET, "Unsecured DNS packet." }, 4965 { WERR_DNS_ERROR_INVALID_TYPE, "Invalid DNS type." }, 4966 { WERR_DNS_ERROR_INVALID_IP_ADDRESS, "Invalid IP address." }, 4967 { WERR_DNS_ERROR_INVALID_PROPERTY, "Invalid property." }, 4968 { WERR_DNS_ERROR_TRY_AGAIN_LATER, "Try DNS operation again later." }, 4969 { WERR_DNS_ERROR_NOT_UNIQUE, "Record for given name and type is not unique." }, 4970 { WERR_DNS_ERROR_NON_RFC_NAME, "DNS name does not comply with RFC specifications." }, 4971 { WERR_DNS_STATUS_FQDN, "DNS name is a fully qualified DNS name." }, 4972 { WERR_DNS_STATUS_DOTTED_NAME, "DNS name is dotted (multilabel)." }, 4973 { WERR_DNS_STATUS_SINGLE_PART_NAME, "DNS name is a single-part name." }, 4974 { WERR_DNS_ERROR_INVALID_NAME_CHAR, "DNS name contains an invalid character." }, 4975 { WERR_DNS_ERROR_NUMERIC_NAME, "DNS name is entirely numeric." }, 4976 { WERR_DNS_ERROR_NOT_ALLOWED_ON_ROOT_SERVER, "The operation requested is not permitted on a DNS root server." }, 4977 { WERR_DNS_ERROR_NOT_ALLOWED_UNDER_DELEGATION, "The record could not be created because this part of the DNS namespace has been delegated to another server." }, 4978 { WERR_DNS_ERROR_CANNOT_FIND_ROOT_HINTS, "The DNS server could not find a set of root hints." }, 4979 { WERR_DNS_ERROR_INCONSISTENT_ROOT_HINTS, "The DNS server found root hints but they were not consistent across all adapters." }, 4980 { WERR_DNS_ERROR_DWORD_VALUE_TOO_SMALL, "The specified value is too small for this parameter." }, 4981 { WERR_DNS_ERROR_DWORD_VALUE_TOO_LARGE, "The specified value is too large for this parameter." }, 4982 { WERR_DNS_ERROR_BACKGROUND_LOADING, "This operation is not allowed while the DNS server is loading zones in the background. Try again later." }, 4983 { WERR_DNS_ERROR_NOT_ALLOWED_ON_RODC, "The operation requested is not permitted on against a DNS server running on a read-only DC." }, 4984 { WERR_DNS_ERROR_ZONE_DOES_NOT_EXIST, "DNS zone does not exist." }, 4985 { WERR_DNS_ERROR_NO_ZONE_INFO, "DNS zone information not available." }, 4986 { WERR_DNS_ERROR_INVALID_ZONE_OPERATION, "Invalid operation for DNS zone." }, 4987 { WERR_DNS_ERROR_ZONE_CONFIGURATION_ERROR, "Invalid DNS zone configuration." }, 4988 { WERR_DNS_ERROR_ZONE_HAS_NO_SOA_RECORD, "DNS zone has no start of authority (SOA) record." }, 4989 { WERR_DNS_ERROR_ZONE_HAS_NO_NS_RECORDS, "DNS zone has no Name Server (NS) record." }, 4990 { WERR_DNS_ERROR_ZONE_LOCKED, "DNS zone is locked." }, 4991 { WERR_DNS_ERROR_ZONE_CREATION_FAILED, "DNS zone creation failed." }, 4992 { WERR_DNS_ERROR_ZONE_ALREADY_EXISTS, "DNS zone already exists." }, 4993 { WERR_DNS_ERROR_AUTOZONE_ALREADY_EXISTS, "DNS automatic zone already exists." }, 4994 { WERR_DNS_ERROR_INVALID_ZONE_TYPE, "Invalid DNS zone type." }, 4995 { WERR_DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP, "Secondary DNS zone requires master IP address." }, 4996 { WERR_DNS_ERROR_ZONE_NOT_SECONDARY, "DNS zone not secondary." }, 4997 { WERR_DNS_ERROR_NEED_SECONDARY_ADDRESSES, "Need secondary IP address." }, 4998 { WERR_DNS_ERROR_WINS_INIT_FAILED, "WINS initialization failed." }, 4999 { WERR_DNS_ERROR_NEED_WINS_SERVERS, "Need WINS servers." }, 5000 { WERR_DNS_ERROR_NBSTAT_INIT_FAILED, "NBTSTAT initialization call failed." }, 5001 { WERR_DNS_ERROR_SOA_DELETE_INVALID, "Invalid delete of SOA." }, 5002 { WERR_DNS_ERROR_FORWARDER_ALREADY_EXISTS, "A conditional forwarding zone already exists for that name." }, 5003 { WERR_DNS_ERROR_ZONE_REQUIRES_MASTER_IP, "This zone must be configured with one or more master DNS server IP addresses." }, 5004 { WERR_DNS_ERROR_ZONE_IS_SHUTDOWN, "The operation cannot be performed because this zone is shut down." }, 5005 { WERR_DNS_ERROR_PRIMARY_REQUIRES_DATAFILE, "The primary DNS zone requires a data file." }, 5006 { WERR_DNS_ERROR_INVALID_DATAFILE_NAME, "Invalid data file name for the DNS zone." }, 5007 { WERR_DNS_ERROR_DATAFILE_OPEN_FAILURE, "Failed to open the data file for the DNS zone." }, 5008 { WERR_DNS_ERROR_FILE_WRITEBACK_FAILED, "Failed to write the data file for the DNS zone." }, 5009 { WERR_DNS_ERROR_DATAFILE_PARSING, "Failure while reading datafile for DNS zone." }, 5010 { WERR_DNS_ERROR_RECORD_DOES_NOT_EXIST, "DNS record does not exist." }, 5011 { WERR_DNS_ERROR_RECORD_FORMAT, "DNS record format error." }, 5012 { WERR_DNS_ERROR_NODE_CREATION_FAILED, "Node creation failure in DNS." }, 5013 { WERR_DNS_ERROR_UNKNOWN_RECORD_TYPE, "Unknown DNS record type." }, 5014 { WERR_DNS_ERROR_RECORD_TIMED_OUT, "DNS record timed out." }, 5015 { WERR_DNS_ERROR_NAME_NOT_IN_ZONE, "Name not in DNS zone." }, 5016 { WERR_DNS_ERROR_CNAME_LOOP, "CNAME loop detected." }, 5017 { WERR_DNS_ERROR_NODE_IS_CNAME, "Node is a CNAME DNS record." }, 5018 { WERR_DNS_ERROR_CNAME_COLLISION, "A CNAME record already exists for the given name." }, 5019 { WERR_DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT, "Record is only at DNS zone root." }, 5020 { WERR_DNS_ERROR_RECORD_ALREADY_EXISTS, "DNS record already exists." }, 5021 { WERR_DNS_ERROR_SECONDARY_DATA, "Secondary DNS zone data error." }, 5022 { WERR_DNS_ERROR_NO_CREATE_CACHE_DATA, "Could not create DNS cache data." }, 5023 { WERR_DNS_ERROR_NAME_DOES_NOT_EXIST, "DNS name does not exist." }, 5024 { WERR_DNS_WARNING_PTR_CREATE_FAILED, "Could not create pointer (PTR) record." }, 5025 { WERR_DNS_WARNING_DOMAIN_UNDELETED, "DNS domain was undeleted." }, 5026 { WERR_DNS_ERROR_DS_UNAVAILABLE, "The directory service is unavailable." }, 5027 { WERR_DNS_ERROR_DS_ZONE_ALREADY_EXISTS, "DNS zone already exists in the directory service." }, 5028 { WERR_DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE, "DNS server not creating or reading the boot file for the directory service integrated DNS zone." }, 5029 { WERR_DNS_INFO_AXFR_COMPLETE, "DNS AXFR (zone transfer) complete." }, 5030 { WERR_DNS_ERROR_AXFR, "DNS zone transfer failed." }, 5031 { WERR_DNS_INFO_ADDED_LOCAL_WINS, "Added local WINS server." }, 5032 { WERR_DNS_STATUS_CONTINUE_NEEDED, "Secure update call needs to continue update request." }, 5033 { WERR_DNS_ERROR_NO_TCPIP, "TCP/IP network protocol not installed." }, 5034 { WERR_DNS_ERROR_NO_DNS_SERVERS, "No DNS servers configured for local system." }, 5035 { WERR_DNS_ERROR_DP_DOES_NOT_EXIST, "The specified directory partition does not exist." }, 5036 { WERR_DNS_ERROR_DP_ALREADY_EXISTS, "The specified directory partition already exists." }, 5037 { WERR_DNS_ERROR_DP_NOT_ENLISTED, "This DNS server is not enlisted in the specified directory partition." }, 5038 { WERR_DNS_ERROR_DP_ALREADY_ENLISTED, "This DNS server is already enlisted in the specified directory partition." }, 5039 { WERR_DNS_ERROR_DP_NOT_AVAILABLE, "The directory partition is not available at this time. Wait a few minutes and try again." }, 5040 { WERR_DNS_ERROR_DP_FSMO_ERROR, "The application directory partition operation failed. The domain controller holding the domain naming master role is down or unable to service the request or is not running Windows Server 2003." }, 4856 5041 { WERR_IPSEC_QM_POLICY_EXISTS, "The specified quick mode policy already exists." }, 4857 5042 { WERR_IPSEC_QM_POLICY_NOT_FOUND, "The specified quick mode policy was not found." }, -
vendor/current/libcli/util/error.h
r414 r740 47 47 NTSTATUS map_nt_error_from_unix(int unix_error); 48 48 49 /********************************************************************* 50 convert a Unix error code to a WERROR 51 *********************************************************************/ 52 WERROR unix_to_werror(int unix_error); 53 54 NTSTATUS nt_status_squash(NTSTATUS nt_status); 55 49 56 #endif /* _SAMBA_ERROR_H */ -
vendor/current/libcli/util/ntstatus.h
r414 r740 6 6 Copyright (C) Luke Kenneth Casson Leighton 1996-2000 7 7 Copyright (C) Paul Ashton 1998-2000 8 8 9 9 This program is free software; you can redistribute it and/or modify 10 10 it under the terms of the GNU General Public License as published by 11 11 the Free Software Foundation; either version 3 of the License, or 12 12 (at your option) any later version. 13 13 14 14 This program is distributed in the hope that it will be useful, 15 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 17 GNU General Public License for more details. 18 18 19 19 You should have received a copy of the GNU General Public License 20 20 along with this program. If not, see <http://www.gnu.org/licenses/>. … … 602 602 #define NT_STATUS_NO_SUCH_JOB NT_STATUS(0xC0000000 | 0xEDE) /* scheduler */ 603 603 #define NT_STATUS_DOWNGRADE_DETECTED NT_STATUS(0xC0000000 | 0x0388) 604 #define NT_STATUS_NO_S4U_PROT_SUPPORT NT_STATUS(0xC0000000 | 0x040A) 605 #define NT_STATUS_CROSSREALM_DELEGATION_FAILURE NT_STATUS(0xC0000000 | 0x040B) 604 606 #define NT_STATUS_NO_SUCH_JOB NT_STATUS(0xC0000000 | 0xEDE) /* scheduler */ 605 607 #define NT_STATUS_RPC_PROTSEQ_NOT_SUPPORTED NT_STATUS(0xC0000000 | 0x20004) 606 608 #define NT_STATUS_RPC_UNSUPPORTED_NAME_SYNTAX NT_STATUS(0xC0000000 | 0x20026) 607 #define NT_STATUS_RPC_NT_CALL_FAILED NT_STATUS(0xC0000000 | 0x2001B) 608 #define NT_STATUS_RPC_NT_PROTOCOL_ERROR NT_STATUS(0xC0000000 | 0x2001D) 609 #define NT_STATUS_RPC_NT_PROCNUM_OUT_OF_RANGE NT_STATUS(0xC0000000 | 0x2002E) 609 #define NT_STATUS_RPC_UNKNOWN_IF NT_STATUS(0xC0000000 | 0x20012) 610 #define NT_STATUS_RPC_CALL_FAILED NT_STATUS(0xC0000000 | 0x2001B) 611 #define NT_STATUS_RPC_PROTOCOL_ERROR NT_STATUS(0xC0000000 | 0x2001D) 612 #define NT_STATUS_RPC_PROCNUM_OUT_OF_RANGE NT_STATUS(0xC0000000 | 0x2002E) 613 #define NT_STATUS_RPC_CANNOT_SUPPORT NT_STATUS(0xC0000000 | 0x20041) 614 #define NT_STATUS_RPC_SEC_PKG_ERROR NT_STATUS(0xC0000000 | 0x20057) 615 #define NT_STATUS_RPC_SS_CONTEXT_MISMATCH NT_STATUS(0xC0000000 | 0x30005) 616 #define NT_STATUS_RPC_ENUM_VALUE_OUT_OF_RANGE NT_STATUS(0xC000000 | 0x3000A) 617 #define NT_STATUS_RPC_BAD_STUB_DATA NT_STATUS(0xC0000000 | 0x3000C) 618 #define NT_STATUS_RPC_INVALID_PIPE_OBJECT NT_STATUS(0xC0000000 | 0x3005C) 619 #define NT_STATUS_RPC_INVALID_PIPE_OPERATION NT_STATUS(0xC0000000 | 0x3005D) 620 #define NT_STATUS_RPC_WRONG_PIPE_VERSION NT_STATUS(0xC0000000 | 0x3005E) 621 #define NT_STATUS_RPC_PIPE_CLOSED NT_STATUS(0xC0000000 | 0x3005F) 622 #define NT_STATUS_RPC_PIPE_DISCIPLINE_ERROR NT_STATUS(0xC0000000 | 0x30060) 623 #define NT_STATUS_RPC_PIPE_EMPTY NT_STATUS(0xC0000000 | 0x30061) 610 624 #define NT_STATUS_ERROR_DS_OBJ_STRING_NAME_EXISTS NT_STATUS(0xC0000000 | 0x2071) 611 625 #define NT_STATUS_ERROR_DS_INCOMPATIBLE_VERSION NT_STATUS(0xC0000000 | 0x00002177) … … 637 651 /** Used by ntstatus_dos_equal: */ 638 652 extern bool ntstatus_check_dos_mapping; 653 654 /* we need these here for openchange */ 655 #ifndef likely 656 #define likely(x) (x) 657 #endif 658 #ifndef unlikely 659 #define unlikely(x) (x) 660 #endif 639 661 640 662 #define NT_STATUS_IS_OK(x) (likely(NT_STATUS_V(x) == 0)) … … 675 697 } while (0) 676 698 699 #define NT_STATUS_NOT_OK_RETURN_AND_FREE(x, ctx) do { \ 700 if (!NT_STATUS_IS_OK(x)) {\ 701 talloc_free(ctx); \ 702 return x;\ 703 }\ 704 } while (0) 705 677 706 #define NT_STATUS_IS_ERR_RETURN(x) do { \ 678 707 if (NT_STATUS_IS_ERR(x)) {\ … … 700 729 #define NT_STATUS_LDAP_CODE(status) (NT_STATUS_V(status) & ~0xFF000000) 701 730 702 #define NT_STATUS_RPC_CANNOT_SUPPORT NT_STATUS(0xC0000000 | 0x20041) 731 #define NT_STATUS_IS_RPC(status) \ 732 (((NT_STATUS_V(status) & 0xFFFF) == 0xC0020000) || \ 733 ((NT_STATUS_V(status) & 0xFFFF) == 0xC0030000)) 703 734 704 735 #endif /* _NTSTATUS_H */ -
vendor/current/libcli/util/werror.h
r414 r740 45 45 #define W_ERROR_HAVE_NO_MEMORY(x) do { \ 46 46 if (!(x)) {\ 47 return WERR_NOMEM;\ 48 }\ 49 } while (0) 50 51 #define W_ERROR_HAVE_NO_MEMORY_AND_FREE(x, ctx) do { \ 52 if (!(x)) {\ 53 talloc_free(ctx); \ 47 54 return WERR_NOMEM;\ 48 55 }\ … … 234 241 #define WERR_SETUP_DOMAIN_CONTROLLER W_ERROR(0x00000A85) 235 242 #define WERR_DEFAULT_JOIN_REQUIRED W_ERROR(0x00000A86) 236 237 /* DS errors */238 #define WERR_DS_NO_ATTRIBUTE_OR_VALUE W_ERROR(0x0000200A)239 #define WERR_DS_INVALID_ATTRIBUTE_SYNTAX W_ERROR(0x0000200B)240 #define WERR_DS_ATTRIBUTE_TYPE_UNDEFINED W_ERROR(0x0000200C)241 #define WERR_DS_ATTRIBUTE_OR_VALUE_EXISTS W_ERROR(0x0000200D)242 #define WERR_DS_BUSY W_ERROR(0x0000200E)243 #define WERR_DS_UNAVAILABLE W_ERROR(0x0000200F)244 #define WERR_DS_OBJ_CLASS_VIOLATION W_ERROR(0x00002014)245 #define WERR_DS_CANT_ON_NON_LEAF W_ERROR(0x00002015)246 #define WERR_DS_CANT_ON_RDN W_ERROR(0x00002016)247 #define WERR_DS_CANT_MOD_OBJ_CLASS W_ERROR(0x00002017)248 #define WERR_DS_OPERATIONS_ERROR W_ERROR(0x00002020)249 #define WERR_DS_PROTOCOL_ERROR W_ERROR(0x00002021)250 #define WERR_DS_TIMELIMIT_EXCEEDED W_ERROR(0x00002022)251 #define WERR_DS_SIZE_LIMIT_EXCEEDED W_ERROR(0x00002023)252 #define WERR_DS_ADMIN_LIMIT_EXCEEDED W_ERROR(0x00002024)253 #define WERR_DS_COMPARE_FALSE W_ERROR(0x00002025)254 #define WERR_DS_COMPARE_TRUE W_ERROR(0x00002026)255 #define WERR_DS_AUTH_METHOD_NOT_SUPPORTED W_ERROR(0x00002027)256 #define WERR_DS_STRONG_AUTH_REQUIRED W_ERROR(0x00002028)257 #define WERR_DS_INAPPROPRIATE_AUTH W_ERROR(0x00002029)258 #define WERR_DS_REFERRAL W_ERROR(0x0000202B)259 #define WERR_DS_UNAVAILABLE_CRIT_EXTENSION W_ERROR(0x0000202C)260 #define WERR_DS_CONFIDENTIALITY_REQUIRED W_ERROR(0x0000202D)261 #define WERR_DS_INAPPROPRIATE_MATCHING W_ERROR(0x0000202E)262 #define WERR_DS_CONSTRAINT_VIOLATION W_ERROR(0x0000202F)263 #define WERR_DS_NO_SUCH_OBJECT W_ERROR(0x00002030)264 #define WERR_DS_ALIAS_PROBLEM W_ERROR(0x00002031)265 #define WERR_DS_INVALID_DN_SYNTAX W_ERROR(0x00002032)266 #define WERR_DS_ALIAS_DEREF_PROBLEM W_ERROR(0x00002034)267 #define WERR_DS_UNWILLING_TO_PERFORM W_ERROR(0x00002035)268 #define WERR_DS_LOOP_DETECT W_ERROR(0x00002036)269 #define WERR_DS_NAMING_VIOLATION W_ERROR(0x00002037)270 #define WERR_DS_AFFECTS_MULTIPLE_DSAS W_ERROR(0x00002039)271 #define WERR_DS_OBJ_STRING_NAME_EXISTS W_ERROR(0x00002071)272 #define WERR_DS_OBJ_NOT_FOUND W_ERROR(0x0000208D)273 #define WERR_DS_GENERIC_ERROR W_ERROR(0x00002095)274 #define WERR_DS_INSUFF_ACCESS_RIGHTS W_ERROR(0x00002098)275 #define WERR_DS_SCHEMA_NOT_LOADED W_ERROR(0x20DE)276 #define WERR_DS_SCHEMA_ALLOC_FAILED W_ERROR(0x20DF)277 #define WERR_DS_ATT_SCHEMA_REQ_SYNTAX W_ERROR(0x000020E0)278 #define WERR_DS_DRA_SCHEMA_MISMATCH W_ERROR(0x000020E2)279 #define WERR_DS_DRA_INVALID_PARAMETER W_ERROR(0x000020F5)280 #define WERR_DS_DRA_BAD_DN W_ERROR(0x000020F7)281 #define WERR_DS_DRA_BAD_NC W_ERROR(0x000020F8)282 #define WERR_DS_DRA_INTERNAL_ERROR W_ERROR(0x000020FA)283 #define WERR_DS_DRA_OUT_OF_MEM W_ERROR(0x000020FE)284 #define WERR_DS_SINGLE_VALUE_CONSTRAINT W_ERROR(0x00002081)285 #define WERR_DS_DRA_DB_ERROR W_ERROR(0x00002103)286 #define WERR_DS_DRA_NO_REPLICA W_ERROR(0x00002104)287 #define WERR_DS_DRA_ACCESS_DENIED W_ERROR(0x00002105)288 #define WERR_DS_DRA_SOURCE_DISABLED W_ERROR(0x00002108)289 #define WERR_DS_DNS_LOOKUP_FAILURE W_ERROR(0x0000214C)290 #define WERR_DS_WRONG_LINKED_ATTRIBUTE_SYNTAX W_ERROR(0x00002150)291 #define WERR_DS_NO_MSDS_INTID W_ERROR(0x00002194)292 #define WERR_DS_DUP_MSDS_INTID W_ERROR(0x00002195)293 243 294 244 /* FRS errors */ … … 2058 2008 #define WERR_DS_NOT_INSTALLED W_ERROR(0x00002008) 2059 2009 #define WERR_DS_MEMBERSHIP_EVALUATED_LOCALLY W_ERROR(0x00002009) 2060 #define WERR_DS_INVALID_ATTRIBUTE_YNTAX W_ERROR(0x0000200B) 2010 #define WERR_DS_NO_ATTRIBUTE_OR_VALUE W_ERROR(0x0000200A) 2011 #define WERR_DS_INVALID_ATTRIBUTE_SYNTAX W_ERROR(0x0000200B) 2012 #define WERR_DS_ATTRIBUTE_TYPE_UNDEFINED W_ERROR(0x0000200C) 2013 #define WERR_DS_ATTRIBUTE_OR_VALUE_EXISTS W_ERROR(0x0000200D) 2014 #define WERR_DS_BUSY W_ERROR(0x0000200E) 2015 #define WERR_DS_UNAVAILABLE W_ERROR(0x0000200F) 2061 2016 #define WERR_DS_NO_RIDS_ALLOCATED W_ERROR(0x00002010) 2062 2017 #define WERR_DS_NO_MORE_RIDS W_ERROR(0x00002011) 2063 2018 #define WERR_DS_INCORRECT_ROLE_OWNER W_ERROR(0x00002012) 2064 2019 #define WERR_DS_RIDMGR_INIT_ERROR W_ERROR(0x00002013) 2020 #define WERR_DS_OBJ_CLASS_VIOLATION W_ERROR(0x00002014) 2021 #define WERR_DS_CANT_ON_NON_LEAF W_ERROR(0x00002015) 2022 #define WERR_DS_CANT_ON_RDN W_ERROR(0x00002016) 2023 #define WERR_DS_CANT_MOD_OBJ_CLASS W_ERROR(0x00002017) 2065 2024 #define WERR_DS_CROSS_DOM_MOVE_ERROR W_ERROR(0x00002018) 2066 2025 #define WERR_DS_GC_NOT_AVAILABLE W_ERROR(0x00002019) … … 2070 2029 #define WERR_PROMOTION_ACTIVE W_ERROR(0x0000201D) 2071 2030 #define WERR_NO_PROMOTION_ACTIVE W_ERROR(0x0000201E) 2031 #define WERR_DS_OPERATIONS_ERROR W_ERROR(0x00002020) 2032 #define WERR_DS_PROTOCOL_ERROR W_ERROR(0x00002021) 2033 #define WERR_DS_TIMELIMIT_EXCEEDED W_ERROR(0x00002022) 2072 2034 #define WERR_DS_SIZELIMIT_EXCEEDED W_ERROR(0x00002023) 2035 #define WERR_DS_ADMIN_LIMIT_EXCEEDED W_ERROR(0x00002024) 2036 #define WERR_DS_COMPARE_FALSE W_ERROR(0x00002025) 2037 #define WERR_DS_COMPARE_TRUE W_ERROR(0x00002026) 2038 #define WERR_DS_AUTH_METHOD_NOT_SUPPORTED W_ERROR(0x00002027) 2039 #define WERR_DS_STRONG_AUTH_REQUIRED W_ERROR(0x00002028) 2040 #define WERR_DS_INAPPROPRIATE_AUTH W_ERROR(0x00002029) 2073 2041 #define WERR_DS_AUTH_UNKNOWN W_ERROR(0x0000202A) 2042 #define WERR_DS_REFERRAL W_ERROR(0x0000202B) 2043 #define WERR_DS_UNAVAILABLE_CRIT_EXTENSION W_ERROR(0x0000202C) 2044 #define WERR_DS_CONFIDENTIALITY_REQUIRED W_ERROR(0x0000202D) 2045 #define WERR_DS_INAPPROPRIATE_MATCHING W_ERROR(0x0000202E) 2046 #define WERR_DS_CONSTRAINT_VIOLATION W_ERROR(0x0000202F) 2047 #define WERR_DS_NO_SUCH_OBJECT W_ERROR(0x00002030) 2048 #define WERR_DS_ALIAS_PROBLEM W_ERROR(0x00002031) 2049 #define WERR_DS_INVALID_DN_SYNTAX W_ERROR(0x00002032) 2074 2050 #define WERR_DS_IS_LEAF W_ERROR(0x00002033) 2051 #define WERR_DS_ALIAS_DEREF_PROBLEM W_ERROR(0x00002034) 2052 #define WERR_DS_UNWILLING_TO_PERFORM W_ERROR(0x00002035) 2053 #define WERR_DS_LOOP_DETECT W_ERROR(0x00002036) 2054 #define WERR_DS_NAMING_VIOLATION W_ERROR(0x00002037) 2075 2055 #define WERR_DS_OBJECT_RESULTS_TOO_LARGE W_ERROR(0x00002038) 2056 #define WERR_DS_AFFECTS_MULTIPLE_DSAS W_ERROR(0x00002039) 2076 2057 #define WERR_DS_SERVER_DOWN W_ERROR(0x0000203A) 2077 2058 #define WERR_DS_LOCAL_ERROR W_ERROR(0x0000203B) … … 2091 2072 #define WERR_DS_ATT_NOT_DEF_IN_SCHEMA W_ERROR(0x0000206F) 2092 2073 #define WERR_DS_MAX_OBJ_SIZE_EXCEEDED W_ERROR(0x00002070) 2074 #define WERR_DS_OBJ_STRING_NAME_EXISTS W_ERROR(0x00002071) 2093 2075 #define WERR_DS_NO_RDN_DEFINED_IN_SCHEMA W_ERROR(0x00002072) 2094 2076 #define WERR_DS_RDN_DOESNT_MATCH_SCHEMA W_ERROR(0x00002073) … … 2105 2087 #define WERR_DS_ATT_ALREADY_EXISTS W_ERROR(0x0000207E) 2106 2088 #define WERR_DS_CANT_ADD_ATT_VALUES W_ERROR(0x00002080) 2089 #define WERR_DS_SINGLE_VALUE_CONSTRAINT W_ERROR(0x00002081) 2107 2090 #define WERR_DS_RANGE_CONSTRAINT W_ERROR(0x00002082) 2108 2091 #define WERR_DS_ATT_VAL_ALREADY_EXISTS W_ERROR(0x00002083) … … 2116 2099 #define WERR_DS_CANT_MIX_MASTER_AND_REPS W_ERROR(0x0000208B) 2117 2100 #define WERR_DS_CHILDREN_EXIST W_ERROR(0x0000208C) 2101 #define WERR_DS_OBJ_NOT_FOUND W_ERROR(0x0000208D) 2118 2102 #define WERR_DS_ALIASED_OBJ_MISSING W_ERROR(0x0000208E) 2119 2103 #define WERR_DS_BAD_NAME_SYNTAX W_ERROR(0x0000208F) … … 2123 2107 #define WERR_DS_OBJECT_BEING_REMOVED W_ERROR(0x00002093) 2124 2108 #define WERR_DS_CANT_DELETE_DSA_OBJ W_ERROR(0x00002094) 2109 #define WERR_DS_GENERIC_ERROR W_ERROR(0x00002095) 2125 2110 #define WERR_DS_DSA_MUST_BE_INT_MASTER W_ERROR(0x00002096) 2126 2111 #define WERR_DS_CLASS_NOT_DSA W_ERROR(0x00002097) 2112 #define WERR_DS_INSUFF_ACCESS_RIGHTS W_ERROR(0x00002098) 2127 2113 #define WERR_DS_ILLEGAL_SUPERIOR W_ERROR(0x00002099) 2128 2114 #define WERR_DS_ATTRIBUTE_OWNED_BY_SAM W_ERROR(0x0000209A) … … 2193 2179 #define WERR_DS_NCNAME_MISSING_CR_REF W_ERROR(0x000020DC) 2194 2180 #define WERR_DS_SECURITY_CHECKING_ERROR W_ERROR(0x000020DD) 2181 #define WERR_DS_SCHEMA_NOT_LOADED W_ERROR(0x20DE) 2182 #define WERR_DS_SCHEMA_ALLOC_FAILED W_ERROR(0x20DF) 2183 #define WERR_DS_ATT_SCHEMA_REQ_SYNTAX W_ERROR(0x000020E0) 2195 2184 #define WERR_DS_GCVERIFY_ERROR W_ERROR(0x000020E1) 2185 #define WERR_DS_DRA_SCHEMA_MISMATCH W_ERROR(0x000020E2) 2196 2186 #define WERR_DS_CANT_FIND_DSA_OBJ W_ERROR(0x000020E3) 2197 2187 #define WERR_DS_CANT_FIND_EXPECTED_NC W_ERROR(0x000020E4) … … 2212 2202 #define WERR_DS_UNABLE_TO_SURRENDER_ROLES W_ERROR(0x000020F3) 2213 2203 #define WERR_DS_DRA_GENERIC W_ERROR(0x000020F4) 2204 #define WERR_DS_DRA_INVALID_PARAMETER W_ERROR(0x000020F5) 2214 2205 #define WERR_DS_DRA_BUSY W_ERROR(0x000020F6) 2206 #define WERR_DS_DRA_BAD_DN W_ERROR(0x000020F7) 2207 #define WERR_DS_DRA_BAD_NC W_ERROR(0x000020F8) 2215 2208 #define WERR_DS_DRA_DN_EXISTS W_ERROR(0x000020F9) 2209 #define WERR_DS_DRA_INTERNAL_ERROR W_ERROR(0x000020FA) 2216 2210 #define WERR_DS_DRA_INCONSISTENT_DIT W_ERROR(0x000020FB) 2217 2211 #define WERR_DS_DRA_CONNECTION_FAILED W_ERROR(0x000020FC) 2218 2212 #define WERR_DS_DRA_BAD_INSTANCE_TYPE W_ERROR(0x000020FD) 2213 #define WERR_DS_DRA_OUT_OF_MEM W_ERROR(0x000020FE) 2219 2214 #define WERR_DS_DRA_MAIL_PROBLEM W_ERROR(0x000020FF) 2220 2215 #define WERR_DS_DRA_REF_ALREADY_EXISTS W_ERROR(0x00002100) 2221 2216 #define WERR_DS_DRA_REF_NOT_FOUND W_ERROR(0x00002101) 2222 2217 #define WERR_DS_DRA_OBJ_IS_REP_SOURCE W_ERROR(0x00002102) 2218 #define WERR_DS_DRA_DB_ERROR W_ERROR(0x00002103) 2219 #define WERR_DS_DRA_NO_REPLICA W_ERROR(0x00002104) 2220 #define WERR_DS_DRA_ACCESS_DENIED W_ERROR(0x00002105) 2223 2221 #define WERR_DS_DRA_NOT_SUPPORTED W_ERROR(0x00002106) 2224 2222 #define WERR_DS_DRA_RPC_CANCELLED W_ERROR(0x00002107) 2223 #define WERR_DS_DRA_SOURCE_DISABLED W_ERROR(0x00002108) 2225 2224 #define WERR_DS_DRA_SINK_DISABLED W_ERROR(0x00002109) 2226 2225 #define WERR_DS_DRA_NAME_COLLISION W_ERROR(0x0000210A) … … 2288 2287 #define WERR_DS_STRING_SD_CONVERSION_FAILED W_ERROR(0x0000214A) 2289 2288 #define WERR_DS_NAMING_MASTER_GC W_ERROR(0x0000214B) 2289 #define WERR_DS_DNS_LOOKUP_FAILURE W_ERROR(0x0000214C) 2290 2290 #define WERR_DS_COULDNT_UPDATE_SPNS W_ERROR(0x0000214D) 2291 2291 #define WERR_DS_CANT_RETRIEVE_SD W_ERROR(0x0000214E) … … 2357 2357 #define WERR_DS_DRS_EXTENSIONS_CHANGED W_ERROR(0x00002192) 2358 2358 #define WERR_DS_REPLICA_SET_CHANGE_NOT_ALLOWED_ON_DISABLED_CR W_ERROR(0x00002193) 2359 #define WERR_DS_NO_MSDS_INTID W_ERROR(0x00002194) 2360 #define WERR_DS_DUP_MSDS_INTID W_ERROR(0x00002195) 2359 2361 #define WERR_DS_EXISTS_IN_RDNATTID W_ERROR(0x00002196) 2360 2362 #define WERR_DS_AUTHORIZATION_FAILED W_ERROR(0x00002197) … … 2387 2389 #define WERR_DS_INVALID_SEARCH_FLAG_SUBTREE W_ERROR(0x000021B2) 2388 2390 #define WERR_DS_INVALID_SEARCH_FLAG_TUPLE W_ERROR(0x000021B3) 2391 #define WERR_DNS_ERROR_RCODE_FORMAT_ERROR W_ERROR(0x00002329) 2392 #define WERR_DNS_ERROR_RCODE_SERVER_FAILURE W_ERROR(0x0000232A) 2393 #define WERR_DNS_ERROR_RCODE_NAME_ERROR W_ERROR(0x0000232B) 2394 #define WERR_DNS_ERROR_RCODE_NOT_IMPLEMENTED W_ERROR(0x0000232C) 2395 #define WERR_DNS_ERROR_RCODE_REFUSED W_ERROR(0x0000232D) 2396 #define WERR_DNS_ERROR_RCODE_YXDOMAIN W_ERROR(0x0000232E) 2397 #define WERR_DNS_ERROR_RCODE_YXRRSET W_ERROR(0x0000232F) 2398 #define WERR_DNS_ERROR_RCODE_NXRRSET W_ERROR(0x00002330) 2399 #define WERR_DNS_ERROR_RCODE_NOTAUTH W_ERROR(0x00002331) 2400 #define WERR_DNS_ERROR_RCODE_NOTZONE W_ERROR(0x00002332) 2401 #define WERR_DNS_ERROR_RCODE_BADSIG W_ERROR(0x00002338) 2402 #define WERR_DNS_ERROR_RCODE_BADKEY W_ERROR(0x00002339) 2403 #define WERR_DNS_ERROR_RCODE_BADTIME W_ERROR(0x0000233A) 2404 #define WERR_DNS_INFO_NO_RECORDS W_ERROR(0x0000251D) 2405 #define WERR_DNS_ERROR_BAD_PACKET W_ERROR(0x0000251E) 2406 #define WERR_DNS_ERROR_NO_PACKET W_ERROR(0x0000251F) 2407 #define WERR_DNS_ERROR_RCODE W_ERROR(0x00002520) 2408 #define WERR_DNS_ERROR_UNSECURE_PACKET W_ERROR(0x00002521) 2409 #define WERR_DNS_ERROR_INVALID_TYPE W_ERROR(0x0000254F) 2410 #define WERR_DNS_ERROR_INVALID_IP_ADDRESS W_ERROR(0x00002550) 2411 #define WERR_DNS_ERROR_INVALID_PROPERTY W_ERROR(0x00002551) 2412 #define WERR_DNS_ERROR_TRY_AGAIN_LATER W_ERROR(0x00002552) 2413 #define WERR_DNS_ERROR_NOT_UNIQUE W_ERROR(0x00002553) 2414 #define WERR_DNS_ERROR_NON_RFC_NAME W_ERROR(0x00002554) 2415 #define WERR_DNS_STATUS_FQDN W_ERROR(0x00002555) 2416 #define WERR_DNS_STATUS_DOTTED_NAME W_ERROR(0x00002556) 2417 #define WERR_DNS_STATUS_SINGLE_PART_NAME W_ERROR(0x00002557) 2418 #define WERR_DNS_ERROR_INVALID_NAME_CHAR W_ERROR(0x00002558) 2419 #define WERR_DNS_ERROR_NUMERIC_NAME W_ERROR(0x00002559) 2420 #define WERR_DNS_ERROR_NOT_ALLOWED_ON_ROOT_SERVER W_ERROR(0x0000255A) 2421 #define WERR_DNS_ERROR_NOT_ALLOWED_UNDER_DELEGATION W_ERROR(0x0000255B) 2422 #define WERR_DNS_ERROR_CANNOT_FIND_ROOT_HINTS W_ERROR(0x0000255C) 2423 #define WERR_DNS_ERROR_INCONSISTENT_ROOT_HINTS W_ERROR(0x0000255D) 2424 #define WERR_DNS_ERROR_DWORD_VALUE_TOO_SMALL W_ERROR(0x0000255E) 2425 #define WERR_DNS_ERROR_DWORD_VALUE_TOO_LARGE W_ERROR(0x0000255F) 2426 #define WERR_DNS_ERROR_BACKGROUND_LOADING W_ERROR(0x00002560) 2427 #define WERR_DNS_ERROR_NOT_ALLOWED_ON_RODC W_ERROR(0x00002561) 2428 #define WERR_DNS_ERROR_ZONE_DOES_NOT_EXIST W_ERROR(0x00002581) 2429 #define WERR_DNS_ERROR_NO_ZONE_INFO W_ERROR(0x00002582) 2430 #define WERR_DNS_ERROR_INVALID_ZONE_OPERATION W_ERROR(0x00002583) 2431 #define WERR_DNS_ERROR_ZONE_CONFIGURATION_ERROR W_ERROR(0x00002584) 2432 #define WERR_DNS_ERROR_ZONE_HAS_NO_SOA_RECORD W_ERROR(0x00002585) 2433 #define WERR_DNS_ERROR_ZONE_HAS_NO_NS_RECORDS W_ERROR(0x00002586) 2434 #define WERR_DNS_ERROR_ZONE_LOCKED W_ERROR(0x00002587) 2435 #define WERR_DNS_ERROR_ZONE_CREATION_FAILED W_ERROR(0x00002588) 2436 #define WERR_DNS_ERROR_ZONE_ALREADY_EXISTS W_ERROR(0x00002589) 2437 #define WERR_DNS_ERROR_AUTOZONE_ALREADY_EXISTS W_ERROR(0x0000258A) 2438 #define WERR_DNS_ERROR_INVALID_ZONE_TYPE W_ERROR(0x0000258B) 2439 #define WERR_DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP W_ERROR(0x0000258C) 2440 #define WERR_DNS_ERROR_ZONE_NOT_SECONDARY W_ERROR(0x0000258D) 2441 #define WERR_DNS_ERROR_NEED_SECONDARY_ADDRESSES W_ERROR(0x0000258E) 2442 #define WERR_DNS_ERROR_WINS_INIT_FAILED W_ERROR(0x0000258F) 2443 #define WERR_DNS_ERROR_NEED_WINS_SERVERS W_ERROR(0x00002590) 2444 #define WERR_DNS_ERROR_NBSTAT_INIT_FAILED W_ERROR(0x00002591) 2445 #define WERR_DNS_ERROR_SOA_DELETE_INVALID W_ERROR(0x00002592) 2446 #define WERR_DNS_ERROR_FORWARDER_ALREADY_EXISTS W_ERROR(0x00002593) 2447 #define WERR_DNS_ERROR_ZONE_REQUIRES_MASTER_IP W_ERROR(0x00002594) 2448 #define WERR_DNS_ERROR_ZONE_IS_SHUTDOWN W_ERROR(0x00002595) 2449 #define WERR_DNS_ERROR_PRIMARY_REQUIRES_DATAFILE W_ERROR(0x000025B3) 2450 #define WERR_DNS_ERROR_INVALID_DATAFILE_NAME W_ERROR(0x000025B4) 2451 #define WERR_DNS_ERROR_DATAFILE_OPEN_FAILURE W_ERROR(0x000025B5) 2452 #define WERR_DNS_ERROR_FILE_WRITEBACK_FAILED W_ERROR(0x000025B6) 2453 #define WERR_DNS_ERROR_DATAFILE_PARSING W_ERROR(0x000025B7) 2454 #define WERR_DNS_ERROR_RECORD_DOES_NOT_EXIST W_ERROR(0x000025E5) 2455 #define WERR_DNS_ERROR_RECORD_FORMAT W_ERROR(0x000025E6) 2456 #define WERR_DNS_ERROR_NODE_CREATION_FAILED W_ERROR(0x000025E7) 2457 #define WERR_DNS_ERROR_UNKNOWN_RECORD_TYPE W_ERROR(0x000025E8) 2458 #define WERR_DNS_ERROR_RECORD_TIMED_OUT W_ERROR(0x000025E9) 2459 #define WERR_DNS_ERROR_NAME_NOT_IN_ZONE W_ERROR(0x000025EA) 2460 #define WERR_DNS_ERROR_CNAME_LOOP W_ERROR(0x000025EB) 2461 #define WERR_DNS_ERROR_NODE_IS_CNAME W_ERROR(0x000025EC) 2462 #define WERR_DNS_ERROR_CNAME_COLLISION W_ERROR(0x000025ED) 2463 #define WERR_DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT W_ERROR(0x000025EE) 2464 #define WERR_DNS_ERROR_RECORD_ALREADY_EXISTS W_ERROR(0x000025EF) 2465 #define WERR_DNS_ERROR_SECONDARY_DATA W_ERROR(0x000025F0) 2466 #define WERR_DNS_ERROR_NO_CREATE_CACHE_DATA W_ERROR(0x000025F1) 2467 #define WERR_DNS_ERROR_NAME_DOES_NOT_EXIST W_ERROR(0x000025F2) 2468 #define WERR_DNS_WARNING_PTR_CREATE_FAILED W_ERROR(0x000025F3) 2469 #define WERR_DNS_WARNING_DOMAIN_UNDELETED W_ERROR(0x000025F4) 2470 #define WERR_DNS_ERROR_DS_UNAVAILABLE W_ERROR(0x000025F5) 2471 #define WERR_DNS_ERROR_DS_ZONE_ALREADY_EXISTS W_ERROR(0x000025F6) 2472 #define WERR_DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE W_ERROR(0x000025F7) 2473 #define WERR_DNS_INFO_AXFR_COMPLETE W_ERROR(0x00002617) 2474 #define WERR_DNS_ERROR_AXFR W_ERROR(0x00002618) 2475 #define WERR_DNS_INFO_ADDED_LOCAL_WINS W_ERROR(0x00002619) 2476 #define WERR_DNS_STATUS_CONTINUE_NEEDED W_ERROR(0x00002649) 2477 #define WERR_DNS_ERROR_NO_TCPIP W_ERROR(0x0000267B) 2478 #define WERR_DNS_ERROR_NO_DNS_SERVERS W_ERROR(0x0000267C) 2479 #define WERR_DNS_ERROR_DP_DOES_NOT_EXIST W_ERROR(0x000026AD) 2480 #define WERR_DNS_ERROR_DP_ALREADY_EXISTS W_ERROR(0x000026AE) 2481 #define WERR_DNS_ERROR_DP_NOT_ENLISTED W_ERROR(0x000026AF) 2482 #define WERR_DNS_ERROR_DP_ALREADY_ENLISTED W_ERROR(0x000026B0) 2483 #define WERR_DNS_ERROR_DP_NOT_AVAILABLE W_ERROR(0x000026B1) 2484 #define WERR_DNS_ERROR_DP_FSMO_ERROR W_ERROR(0x000026B2) 2389 2485 #define WERR_IPSEC_QM_POLICY_EXISTS W_ERROR(0x000032C8) 2390 2486 #define WERR_IPSEC_QM_POLICY_NOT_FOUND W_ERROR(0x000032C9)
Note:
See TracChangeset
for help on using the changeset viewer.