Changeset 745 for trunk/server/libcli
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 16 deleted
- 50 edited
- 61 copied
-
. (modified) (1 prop)
-
libcli/auth/config.mk (deleted)
-
libcli/auth/credentials.c (modified) (1 diff)
-
libcli/auth/credentials.h (modified) (1 diff)
-
libcli/auth/msrpc_parse.c (modified) (11 diffs)
-
libcli/auth/msrpc_parse.h (modified) (2 diffs)
-
libcli/auth/ntlm_check.c (modified) (20 diffs)
-
libcli/auth/ntlmssp.c (copied) (copied from vendor/current/libcli/auth/ntlmssp.c )
-
libcli/auth/ntlmssp.h (copied) (copied from vendor/current/libcli/auth/ntlmssp.h )
-
libcli/auth/ntlmssp_ndr.c (copied) (copied from vendor/current/libcli/auth/ntlmssp_ndr.c )
-
libcli/auth/ntlmssp_ndr.h (copied) (copied from vendor/current/libcli/auth/ntlmssp_ndr.h )
-
libcli/auth/ntlmssp_private.h (copied) (copied from vendor/current/libcli/auth/ntlmssp_private.h )
-
libcli/auth/ntlmssp_server.c (copied) (copied from vendor/current/libcli/auth/ntlmssp_server.c )
-
libcli/auth/ntlmssp_sign.c (copied) (copied from vendor/current/libcli/auth/ntlmssp_sign.c )
-
libcli/auth/pam_errors.c (copied) (copied from vendor/current/libcli/auth/pam_errors.c )
-
libcli/auth/pam_errors.h (copied) (copied from vendor/current/libcli/auth/pam_errors.h )
-
libcli/auth/proto.h (modified) (1 diff)
-
libcli/auth/schannel_proto.h (modified) (2 diffs)
-
libcli/auth/schannel_sign.c (modified) (1 diff)
-
libcli/auth/schannel_state.h (modified) (2 diffs)
-
libcli/auth/schannel_state_ldb.c (deleted)
-
libcli/auth/schannel_state_proto.h (deleted)
-
libcli/auth/schannel_state_tdb.c (modified) (9 diffs)
-
libcli/auth/smbdes.c (modified) (2 diffs)
-
libcli/auth/smbencrypt.c (modified) (4 diffs)
-
libcli/auth/spnego.h (modified) (2 diffs)
-
libcli/auth/spnego_parse.c (modified) (4 diffs)
-
libcli/auth/wscript_build (copied) (copied from vendor/current/libcli/auth/wscript_build )
-
libcli/cldap/cldap.c (modified) (14 diffs)
-
libcli/cldap/cldap.h (modified) (2 diffs)
-
libcli/cldap/config.mk (deleted)
-
libcli/cldap/wscript_build (copied) (copied from vendor/current/libcli/cldap/wscript_build )
-
libcli/drsuapi/config.mk (deleted)
-
libcli/drsuapi/repl_decrypt.c (modified) (2 diffs)
-
libcli/drsuapi/wscript_build (copied) (copied from vendor/current/libcli/drsuapi/wscript_build )
-
libcli/echo (copied) (copied from vendor/current/libcli/echo )
-
libcli/echo/echo.c (copied) (copied from vendor/current/libcli/echo/echo.c )
-
libcli/echo/libecho.h (copied) (copied from vendor/current/libcli/echo/libecho.h )
-
libcli/echo/tests (copied) (copied from vendor/current/libcli/echo/tests )
-
libcli/echo/tests/echo.c (copied) (copied from vendor/current/libcli/echo/tests/echo.c )
-
libcli/echo/tests/wscript_build (copied) (copied from vendor/current/libcli/echo/tests/wscript_build )
-
libcli/echo/wscript_build (copied) (copied from vendor/current/libcli/echo/wscript_build )
-
libcli/ldap/config.mk (deleted)
-
libcli/ldap/ldap_message.c (modified) (4 diffs)
-
libcli/ldap/ldap_message.h (modified) (1 diff)
-
libcli/ldap/ldap_ndr.c (modified) (4 diffs)
-
libcli/ldap/ldap_ndr.h (modified) (2 diffs)
-
libcli/ldap/wscript_build (copied) (copied from vendor/current/libcli/ldap/wscript_build )
-
libcli/named_pipe_auth/config.mk (deleted)
-
libcli/named_pipe_auth/npa_tstream.c (modified) (23 diffs)
-
libcli/named_pipe_auth/npa_tstream.h (modified) (2 diffs)
-
libcli/named_pipe_auth/wscript_build (copied) (copied from vendor/current/libcli/named_pipe_auth/wscript_build )
-
libcli/nbt/config.mk (deleted)
-
libcli/nbt/dns_hosts_file.c (copied) (copied from vendor/current/libcli/nbt/dns_hosts_file.c )
-
libcli/nbt/libnbt.h (modified) (5 diffs)
-
libcli/nbt/lmhosts.c (modified) (2 diffs)
-
libcli/nbt/man/nmblookup.1.xml (modified) (4 diffs)
-
libcli/nbt/namerefresh.c (modified) (5 diffs)
-
libcli/nbt/nameregister.c (modified) (7 diffs)
-
libcli/nbt/nbt_proto.h (modified) (1 diff)
-
libcli/nbt/nbtname.c (modified) (8 diffs)
-
libcli/nbt/nbtsocket.c (modified) (6 diffs)
-
libcli/nbt/pynbt.c (modified) (10 diffs)
-
libcli/nbt/tools/nmblookup.c (modified) (3 diffs)
-
libcli/nbt/wscript_build (copied) (copied from vendor/current/libcli/nbt/wscript_build )
-
libcli/ndr_netlogon.c (deleted)
-
libcli/ndr_netlogon_proto.h (deleted)
-
libcli/netlogon (copied) (copied from vendor/current/libcli/netlogon )
-
libcli/netlogon.c (deleted)
-
libcli/netlogon.h (deleted)
-
libcli/netlogon/ndr_netlogon.c (copied) (copied from vendor/current/libcli/netlogon/ndr_netlogon.c )
-
libcli/netlogon/ndr_netlogon_proto.h (copied) (copied from vendor/current/libcli/netlogon/ndr_netlogon_proto.h )
-
libcli/netlogon/netlogon.c (copied) (copied from vendor/current/libcli/netlogon/netlogon.c )
-
libcli/netlogon/netlogon.h (copied) (copied from vendor/current/libcli/netlogon/netlogon.h )
-
libcli/netlogon/netlogon_proto.h (copied) (copied from vendor/current/libcli/netlogon/netlogon_proto.h )
-
libcli/netlogon/wscript_build (copied) (copied from vendor/current/libcli/netlogon/wscript_build )
-
libcli/netlogon_proto.h (deleted)
-
libcli/registry (copied) (copied from vendor/current/libcli/registry )
-
libcli/registry/util_reg.c (copied) (copied from vendor/current/libcli/registry/util_reg.c )
-
libcli/registry/util_reg.h (copied) (copied from vendor/current/libcli/registry/util_reg.h )
-
libcli/registry/wscript_build (copied) (copied from vendor/current/libcli/registry/wscript_build )
-
libcli/samsync/config.mk (deleted)
-
libcli/samsync/decrypt.c (modified) (1 diff)
-
libcli/samsync/samsync.h (modified) (1 diff)
-
libcli/samsync/wscript_build (copied) (copied from vendor/current/libcli/samsync/wscript_build )
-
libcli/security/access_check.c (copied) (copied from vendor/current/libcli/security/access_check.c )
-
libcli/security/access_check.h (copied) (copied from vendor/current/libcli/security/access_check.h )
-
libcli/security/config.mk (deleted)
-
libcli/security/create_descriptor.c (copied) (copied from vendor/current/libcli/security/create_descriptor.c )
-
libcli/security/display_sec.c (modified) (3 diffs)
-
libcli/security/display_sec.h (copied) (copied from vendor/current/libcli/security/display_sec.h )
-
libcli/security/dom_sid.c (modified) (5 diffs)
-
libcli/security/dom_sid.h (modified) (2 diffs)
-
libcli/security/object_tree.c (copied) (copied from vendor/current/libcli/security/object_tree.c )
-
libcli/security/privileges.c (copied) (copied from vendor/current/libcli/security/privileges.c )
-
libcli/security/privileges.h (copied) (copied from vendor/current/libcli/security/privileges.h )
-
libcli/security/privileges_private.h (copied) (copied from vendor/current/libcli/security/privileges_private.h )
-
libcli/security/pysecurity.c (copied) (copied from vendor/current/libcli/security/pysecurity.c )
-
libcli/security/sddl.c (copied) (copied from vendor/current/libcli/security/sddl.c )
-
libcli/security/sddl.h (copied) (copied from vendor/current/libcli/security/sddl.h )
-
libcli/security/secace.c (modified) (12 diffs)
-
libcli/security/secace.h (modified) (1 diff)
-
libcli/security/secacl.c (modified) (2 diffs)
-
libcli/security/secacl.h (modified) (1 diff)
-
libcli/security/security.h (copied) (copied from vendor/current/libcli/security/security.h )
-
libcli/security/security_descriptor.c (modified) (5 diffs)
-
libcli/security/security_descriptor.h (modified) (1 diff)
-
libcli/security/security_token.c (copied) (copied from vendor/current/libcli/security/security_token.c )
-
libcli/security/security_token.h (copied) (copied from vendor/current/libcli/security/security_token.h )
-
libcli/security/session.c (copied) (copied from vendor/current/libcli/security/session.c )
-
libcli/security/session.h (copied) (copied from vendor/current/libcli/security/session.h )
-
libcli/security/util_sid.c (copied) (copied from vendor/current/libcli/security/util_sid.c )
-
libcli/security/wscript_build (copied) (copied from vendor/current/libcli/security/wscript_build )
-
libcli/smb/config.mk (deleted)
-
libcli/smb/smb2_constants.h (modified) (6 diffs)
-
libcli/smb/wscript_build (copied) (copied from vendor/current/libcli/smb/wscript_build )
-
libcli/smbreadline (copied) (copied from vendor/current/libcli/smbreadline )
-
libcli/smbreadline/smbreadline.c (copied) (copied from vendor/current/libcli/smbreadline/smbreadline.c ) (1 diff)
-
libcli/smbreadline/smbreadline.h (copied) (copied from vendor/current/libcli/smbreadline/smbreadline.h )
-
libcli/smbreadline/wscript_build (copied) (copied from vendor/current/libcli/smbreadline/wscript_build )
-
libcli/smbreadline/wscript_configure (copied) (copied from vendor/current/libcli/smbreadline/wscript_configure )
-
libcli/util/doserr.c (modified) (7 diffs)
-
libcli/util/error.h (modified) (1 diff)
-
libcli/util/ntstatus.h (modified) (6 diffs)
-
libcli/util/tstream.c (copied) (copied from vendor/current/libcli/util/tstream.c )
-
libcli/util/tstream.h (copied) (copied from vendor/current/libcli/util/tstream.h )
-
libcli/util/werror.h (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 581,587,591,594,597,600,615,618,740
- Property svn:mergeinfo changed
-
trunk/server/libcli/auth/credentials.c
r590 r745 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; -
trunk/server/libcli/auth/credentials.h
r414 r745 69 69 #define NETLOGON_NEG_AUTH2_ADS_FLAGS (0x200fbffb | NETLOGON_NEG_ARCFOUR | NETLOGON_NEG_128BIT | NETLOGON_NEG_SCHANNEL) 70 70 71 71 72 -
trunk/server/libcli/auth/msrpc_parse.c
r414 r745 41 41 C = constant ascii string 42 42 */ 43 boolmsrpc_gen(TALLOC_CTX *mem_ctx,43 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 61 62 60 63 intargs = talloc_array(pointers, int, strlen(format)); 64 65 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 ; 76 82 } 77 83 pointers[i].length = n; … … 87 93 if (!ret) { 88 94 va_end(ap); 89 return false;95 return ; 90 96 } 91 97 pointers[i].length = n; … … 103 109 if (!ret) { 104 110 va_end(ap); 105 return false;111 return ; 106 112 } 107 113 pointers[i].length = n; … … 133 139 head_size += pointers[i].length; 134 140 break; 141 142 143 135 144 } 136 145 } 137 146 va_end(ap); 147 148 149 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 204 205 185 206 } 186 207 } … … 189 210 talloc_free(pointers); 190 211 191 return true;212 return ; 192 213 } 193 214 … … 229 250 bool ret = true; 230 251 252 253 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, ut); 337 362 /* make sure its in the right format - be strict */ 338 363 NEED_DATA(len1); -
trunk/server/libcli/auth/msrpc_parse.h
r414 r745 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 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 msrpc_gen(TALLOC_CTX *mem_ctx, 15 36 DATA_BLOB *blob, 16 37 const char *format, ...); -
trunk/server/libcli/auth/ntlm_check.c
r414 r745 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 bool lanman_auth,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 bool lanman_auth,285 bool ntlm_auth,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, becuse 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, -
trunk/server/libcli/auth/proto.h
r590 r745 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], uint8_t in[16], const uint8_t key[14], int forw); 198 void sam_rid_crypt(ut rid, const uint8_t *in, uint8_t *out, int forw); 199 199 #undef _PRINTF_ATTRIBUTE 200 200 #define _PRINTF_ATTRIBUTE(a1, a2) -
trunk/server/libcli/auth/schannel_proto.h
r414 r745 24 24 #define _LIBCLI_AUTH_SCHANNEL_PROTO_H__ 25 25 26 27 28 29 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 31 37 NTSTATUS netsec_outgoing_packet(struct schannel_state *state, 32 38 TALLOC_CTX *mem_ctx, -
trunk/server/libcli/auth/schannel_sign.c
r414 r745 205 205 } 206 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 207 221 NTSTATUS netsec_outgoing_packet(struct schannel_state *state, 208 222 TALLOC_CTX *mem_ctx, -
trunk/server/libcli/auth/schannel_state.h
r414 r745 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 -
trunk/server/libcli/auth/schannel_state_tdb.c
r414 r745 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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 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, 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))); 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 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(0,("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, 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 139 187 140 188 if (!NT_STATUS_IS_OK(status)) { … … 148 196 } 149 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 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 const char *computer_name,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_c, 276 , 277 const char *computer_name, 278 , 279 , 280 281 { 282 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 -
trunk/server/libcli/auth/smbdes.c
r414 r745 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], 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(ut rid, const uint8_t *in, uint8_t *out, int forw) 371 371 { 372 372 uint8_t s[14]; -
trunk/server/libcli/auth/smbencrypt.c
r414 r745 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 size_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 543 544 540 545 541 546 memcpy(&buffer[512 - new_pw_len], new_pw, new_pw_len); -
trunk/server/libcli/auth/spnego.h
r414 r745 26 26 #define OID_KERBEROS5 "1.2.840.113554.1.2.2" 27 27 28 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 39 40 41 42 35 43 36 44 enum spnego_negResult { -
trunk/server/libcli/auth/spnego_parse.c
r480 r745 50 50 for (i = 0; !asn1->has_error && 51 51 0 < asn1_tag_remaining(asn1); i++) { 52 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 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 388 389 390 383 391 /* Write mechTypes */ 384 392 if (mech_types && *mech_types) { -
trunk/server/libcli/cldap/cldap.c
r414 r745 168 168 } 169 169 170 static voidcldap_socket_recv_dgram(struct cldap_socket *c,170 static 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 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 cldap_socket_recv_dgram(c, in); 203 204 in = NULL; 204 205 205 if (! cldap_recvfrom_setup(c)) {206 if (!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 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; 266 267 } 267 268 … … 271 272 search->response.asn1->ofs = 0; 272 273 274 275 276 277 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 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)) { -
trunk/server/libcli/cldap/cldap.h
r414 r745 20 20 */ 21 21 22 #include "../libcli/netlogon .h"22 #include "../libcli/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, -
trunk/server/libcli/drsuapi/repl_decrypt.c
r414 r745 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_ATT_dBCSPwd: 150 case DRSUAPI_ATT_unicodePwd: 151 case DRSUAPI_ATT_ntPwdHistory: 152 case DRSUAPI_ATT_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_ATT_supplementalCredentials: 156 case DRSUAPI_ATT_priorValue: 157 case DRSUAPI_ATT_currentValue: 158 case DRSUAPI_ATT_trustAuthOutgoing: 159 case DRSUAPI_ATT_trustAuthIncoming: 160 case DRSUAPI_ATT_initialAuthOutgoing: 161 case DRSUAPI_ATT_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_ATT_dBCSPwd: 312 case DRSUAPI_ATT_unicodePwd: 313 case DRSUAPI_ATT_ntPwdHistory: 314 case DRSUAPI_ATT_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_ATT_supplementalCredentials: 318 case DRSUAPI_ATT_priorValue: 319 case DRSUAPI_ATT_currentValue: 320 case DRSUAPI_ATT_trustAuthOutgoing: 321 case DRSUAPI_ATT_trustAuthIncoming: 322 case DRSUAPI_ATT_initialAuthOutgoing: 323 case DRSUAPI_ATT_initialAuthIncoming: 324 324 break; 325 325 default: -
trunk/server/libcli/ldap/ldap_message.c
r414 r745 168 168 169 169 for (i = 0; handlers[i].oid != NULL; i++) { 170 171 172 173 174 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 444 437 445 break; 438 446 } … … 669 677 control_handlers, 670 678 msg->controls[i])) { 679 680 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 } -
trunk/server/libcli/ldap/ldap_message.h
r414 r745 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 { -
trunk/server/libcli/ldap/ldap_ndr.c
r414 r745 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, struct GUID *guid) 65 69 { 66 70 DATA_BLOB blob; 67 enum ndr_err_code ndr_err;71 ; 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); -
trunk/server/libcli/ldap/ldap_ndr.h
r414 r745 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 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, struct GUID *guid); 9 31 NTSTATUS ldap_decode_ndr_GUID(TALLOC_CTX *mem_ctx, struct ldb_val val, struct GUID *guid); 10 32 -
trunk/server/libcli/named_pipe_auth/npa_tstream.c
r414 r745 25 25 #include "../librpc/gen_ndr/ndr_named_pipe_auth.h" 26 26 #include "../libcli/named_pipe_auth/npa_tstream.h" 27 27 28 #include "libcli/raw/smb.h" 29 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 77 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 = 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 = ; 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 412 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 = 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 = 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 = 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 = 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 = 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 = 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 i 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, , left); 752 735 if (!npas->pending.iov_base) { 753 736 return -1; … … 809 792 810 793 /* the header for message mode */ 794 811 795 uint8_t hdr[2]; 812 796 … … 845 829 switch (npas->file_type) { 846 830 case FILE_TYPE_BYTE_MODE_PIPE: 831 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 = 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 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 902 903 904 905 912 906 } 913 907 … … 1070 1064 } 1071 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 -
trunk/server/libcli/named_pipe_auth/npa_tstream.h
r414 r745 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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 60 120 #endif /* NPA_TSTREAM_H */ -
trunk/server/libcli/nbt/libnbt.h
r414 r745 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 370 371 372 373 374 375 376 377 378 379 380 363 381 #endif /* __LIBNBT_H__ */ -
trunk/server/libcli/nbt/lmhosts.c
r414 r745 27 27 #include "system/filesys.h" 28 28 #include "system/network.h" 29 29 30 30 31 /******************************************************** … … 156 157 } 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 -
trunk/server/libcli/nbt/man/nmblookup.1.xml
r414 r745 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 "-//"> 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> -
trunk/server/libcli/nbt/namerefresh.c
r414 r745 21 21 22 22 #include "includes.h" 23 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 28 28 29 /* … … 143 144 reply for each address 144 145 */ 145 struct refresh_wins_state {146 struct 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 } -
trunk/server/libcli/nbt/nameregister.c
r414 r745 21 21 22 22 #include "includes.h" 23 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 28 29 29 30 /* … … 149 150 a name registration demand 150 151 */ 151 struct register_bcast_state {152 struct 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 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 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 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 411 412 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 } -
trunk/server/libcli/nbt/nbt_proto.h
r414 r745 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 22 #ifndef _____LIBCLI_NBT_NBT_PROTO_H__ 2 23 #define _____LIBCLI_NBT_NBT_PROTO_H__ -
trunk/server/libcli/nbt/nbtname.c
r596 r745 28 28 #include "librpc/gen_ndr/ndr_misc.h" 29 29 #include "system/locale.h" 30 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 ut 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] > 0x00003F", 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 524 525 526 527 528 529 530 531 532 533 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 > 1) { 565 r->scope = talloc_strndup(r, (char *)(namebuf+1), 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 635 636 637 638 639 640 641 642 643 644 619 645 620 646 talloc_free(namebuf); -
trunk/server/libcli/nbt/nbtsocket.c
r414 r745 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 = ; 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); -
trunk/server/libcli/nbt/pynbt.c
r414 r745 18 18 */ 19 19 20 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 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 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() 42 { 43 talloc_free(->mem_ctx); 44 ); 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 = py_nbt_node_dealloc, 397 399 .tp_methods = py_nbt_methods, 398 400 .tp_doc = "Node()\n" -
trunk/server/libcli/nbt/tools/nmblookup.c
r414 r745 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, lp_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, lp_nbt_port(cmdline_lp_ctx)); 368 368 } 369 369 -
trunk/server/libcli/samsync/decrypt.c
r414 r745 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)) { -
trunk/server/libcli/samsync/samsync.h
r414 r745 23 23 #define __SAMSYNC_SAMSYNC_H__ 24 24 25 26 25 27 /** 26 28 * Fix up the delta, dealing with encryption issues so that the final -
trunk/server/libcli/security/display_sec.c
r414 r745 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 26 25 27 26 /**************************************************************************** … … 160 159 static void disp_sec_ace_object(struct security_ace_object *object) 161 160 { 161 162 162 if (object->flags & SEC_ACE_OBJECT_TYPE_PRESENT) { 163 164 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", 167 ); 166 168 } 167 169 if (object->flags & SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT) { 170 171 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", 174 ); 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 t i; 238 239 printf("\tACL\tNum ACEs:\t%\trevision:\t%x\n", 236 240 sec_acl->num_aces, sec_acl->revision); 237 241 printf("\t---\n"); -
trunk/server/libcli/security/dom_sid.c
r583 r745 29 29 *****************************************************************/ 30 30 31 staticint dom_sid_compare_auth(const struct dom_sid *sid1,32 const struct dom_sid *sid2)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 = _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 302 talloc_free(sid); 303 ; 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(len, "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(, "-%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 } -
trunk/server/libcli/security/dom_sid.h
r583 r745 26 26 #include "librpc/gen_ndr/security.h" 27 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 28 57 int dom_sid_compare(const struct dom_sid *sid1, const struct dom_sid *sid2); 58 59 29 60 bool dom_sid_equal(const struct dom_sid *sid1, const struct dom_sid *sid2); 61 62 63 64 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 78 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_*/ -
trunk/server/libcli/security/secace.c
r414 r745 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, 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, 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, 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, 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( 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( 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( 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 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 -
trunk/server/libcli/security/secace.h
r414 r745 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, 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, 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 *s2); 34 int nt_ace_inherit_comp( struct security_ace *a2); 35 int nt_ace_canon_comp( struct security_ace *a2); 36 36 void dacl_sort_into_canonical_order(struct security_ace *srclist, unsigned int num_aces); 37 37 -
trunk/server/libcli/security/secacl.c
r414 r745 24 24 #include "librpc/gen_ndr/ndr_security.h" 25 25 #include "libcli/security/secace.h" 26 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 } -
trunk/server/libcli/security/secacl.h
r414 r745 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 -
trunk/server/libcli/security/security_descriptor.c
r414 r745 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 58 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 t i; 86 89 87 90 if (!acl1 && !acl2) … … 268 271 const struct dom_sid *trustee) 269 272 { 270 int i;273 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 t i; 365 368 366 369 if (acl1 == acl2) return true; -
trunk/server/libcli/security/security_descriptor.h
r414 r745 69 69 const struct security_acl *acl2); 70 70 71 72 73 74 75 76 77 78 79 80 81 82 83 71 84 #endif /* __SECURITY_DESCRIPTOR_H__ */ -
trunk/server/libcli/smb/smb2_constants.h
r414 r745 29 29 #define SMB2_HDR_STATUS 0x08 30 30 #define SMB2_HDR_OPCODE 0x0c 31 #define SMB2_HDR_CREDIT 0x0e31 #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 42 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 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 96 97 98 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 114 103 115 104 116 /* SMB2 create security flags */ … … 173 185 #define SMB2_GETINFO_QUOTA 0x04 174 186 187 188 175 189 #endif -
trunk/server/libcli/smbreadline/smbreadline.c
r741 r745 100 100 return ret; 101 101 } 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 102 151 if (callback) { 103 152 callback(); -
trunk/server/libcli/util/doserr.c
r414 r745 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 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 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_YNTAX, "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 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 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." }, -
trunk/server/libcli/util/error.h
r414 r745 47 47 NTSTATUS map_nt_error_from_unix(int unix_error); 48 48 49 50 51 52 53 54 55 49 56 #endif /* _SAMBA_ERROR_H */ -
trunk/server/libcli/util/ntstatus.h
r456 r745 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/>. … … 30 30 */ 31 31 32 #if defined(HAVE_IMMEDIATE_STRUCTURES) && !defined(__OS2__)32 #if defined(HAVE_IMMEDIATE_STRUCTURES) && !defined(__OS2__) 33 33 typedef struct {uint32_t v;} NTSTATUS; 34 34 #define NT_STATUS(x) ((NTSTATUS) { x }) … … 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 605 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 655 656 657 658 659 660 639 661 640 662 #define NT_STATUS_IS_OK(x) (likely(NT_STATUS_V(x) == 0)) … … 675 697 } while (0) 676 698 699 700 701 702 703 704 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 */ -
trunk/server/libcli/util/werror.h
r456 r745 30 30 */ 31 31 32 #if defined(HAVE_IMMEDIATE_STRUCTURES) && !defined(__OS2__)32 #if defined(HAVE_IMMEDIATE_STRUCTURES) && !defined(__OS2__) 33 33 typedef struct {uint32_t v;} WERROR; 34 34 #define W_ERROR(x) ((WERROR) { x }) … … 45 45 #define W_ERROR_HAVE_NO_MEMORY(x) do { \ 46 46 if (!(x)) {\ 47 48 49 50 51 52 53 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 2021 2022 2023 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 2032 2033 2072 2034 #define WERR_DS_SIZELIMIT_EXCEEDED W_ERROR(0x00002023) 2035 2036 2037 2038 2039 2040 2073 2041 #define WERR_DS_AUTH_UNKNOWN W_ERROR(0x0000202A) 2042 2043 2044 2045 2046 2047 2048 2049 2074 2050 #define WERR_DS_IS_LEAF W_ERROR(0x00002033) 2051 2052 2053 2054 2075 2055 #define WERR_DS_OBJECT_RESULTS_TOO_LARGE W_ERROR(0x00002038) 2056 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 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 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 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 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 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 2182 2183 2195 2184 #define WERR_DS_GCVERIFY_ERROR W_ERROR(0x000020E1) 2185 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 2214 2205 #define WERR_DS_DRA_BUSY W_ERROR(0x000020F6) 2206 2207 2215 2208 #define WERR_DS_DRA_DN_EXISTS W_ERROR(0x000020F9) 2209 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 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 2219 2220 2223 2221 #define WERR_DS_DRA_NOT_SUPPORTED W_ERROR(0x00002106) 2224 2222 #define WERR_DS_DRA_RPC_CANCELLED W_ERROR(0x00002107) 2223 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 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 2360 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 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 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.
