Changeset 342 for branches/samba-3.3.x/source
- Timestamp:
- Oct 30, 2009, 9:39:05 AM (16 years ago)
- Location:
- branches/samba-3.3.x/source
- Files:
-
- 52 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.3.x/source/Makefile.in
r260 r342 1379 1379 $(KRB5LIBS) $(LDAP_LIBS) $(POPT_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) 1380 1380 1381 bin/mount.cifs@EXEEXT@: $(BINARY_PREREQS) $(CIFS_MOUNT_OBJ) @BUILD_POPT@1382 @echo Linking $@ 1383 @$(CC) $(FLAGS) -o $@ $(CIFS_MOUNT_OBJ) $(DYNEXP) $(LDFLAGS) $(POPT_LIBS)1384 1385 bin/umount.cifs@EXEEXT@: $(BINARY_PREREQS) $(CIFS_UMOUNT_OBJ) @BUILD_POPT@1386 @echo Linking $@ 1387 @$(CC) $(FLAGS) -o $@ $(CIFS_UMOUNT_OBJ) $(DYNEXP) $(LDFLAGS) $(POPT_LIBS)1381 bin/mount.cifs@EXEEXT@: $(BINARY_PREREQS) $(CIFS_MOUNT_OBJ) 1382 @echo Linking $@ 1383 @$(CC) $(FLAGS) -o $@ $(CIFS_MOUNT_OBJ) $(DYNEXP) $(LDFLAGS) 1384 1385 bin/umount.cifs@EXEEXT@: $(BINARY_PREREQS) $(CIFS_UMOUNT_OBJ) 1386 @echo Linking $@ 1387 @$(CC) $(FLAGS) -o $@ $(CIFS_UMOUNT_OBJ) $(DYNEXP) $(LDFLAGS) 1388 1388 1389 1389 bin/cifs.upcall@EXEEXT@: $(BINARY_PREREQS) $(CIFS_UPCALL_OBJ) $(LIBSMBCLIENT_OBJ1) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@ -
branches/samba-3.3.x/source/VERSION
r338 r342 26 26 SAMBA_VERSION_MAJOR=3 27 27 SAMBA_VERSION_MINOR=3 28 SAMBA_VERSION_RELEASE= 828 SAMBA_VERSION_RELEASE=9 29 29 30 30 ######################################################## -
branches/samba-3.3.x/source/auth/auth_domain.c
r206 r342 176 176 /* We also setup the creds chain in the open_schannel call. */ 177 177 result = cli_rpc_pipe_open_schannel( 178 *cli, &ndr_table_netlogon.syntax_id, 178 *cli, &ndr_table_netlogon.syntax_id, NCACN_NP, 179 179 PIPE_AUTH_LEVEL_PRIVACY, domain, &netlogon_pipe); 180 180 } else { -
branches/samba-3.3.x/source/client/mount.cifs.c
r338 r342 1037 1037 } 1038 1038 1039 static void print_cifs_mount_version(void) 1040 { 1041 printf("mount.cifs version: %s.%s%s\n", 1042 MOUNT_CIFS_VERSION_MAJOR, 1043 MOUNT_CIFS_VERSION_MINOR, 1044 MOUNT_CIFS_VENDOR_SUFFIX); 1045 } 1046 1039 1047 int main(int argc, char ** argv) 1040 1048 { … … 1098 1106 } 1099 1107 mountpoint = argv[2]; 1108 } else if (argc == 2) { 1109 if ((strcmp(argv[1], "-V") == 0) || 1110 (strcmp(argv[1], "--version") == 0)) 1111 { 1112 print_cifs_mount_version(); 1113 exit(0); 1114 } 1115 1116 if ((strcmp(argv[1], "-h") == 0) || 1117 (strcmp(argv[1], "-?") == 0) || 1118 (strcmp(argv[1], "--help") == 0)) 1119 { 1120 mount_cifs_usage(); 1121 exit(0); 1122 } 1123 1124 mount_cifs_usage(); 1125 exit(EX_USAGE); 1100 1126 } else { 1101 if ((strcmp (argv[1], "--version") == 0) ||1102 ((strcmp (argv[1], "-V") == 0))) {1103 printf ("mount.cifs version: %s.%s%s\n",1104 MOUNT_CIFS_VERSION_MAJOR,1105 MOUNT_CIFS_VERSION_MINOR,1106 MOUNT_CIFS_VENDOR_SUFFIX);1107 exit (0);1108 }1109 1127 mount_cifs_usage(); 1110 1128 exit(EX_USAGE); … … 1162 1180 ++verboseflag; 1163 1181 break; 1164 case 'V': 1165 printf ("mount.cifs version: %s.%s%s\n", 1166 MOUNT_CIFS_VERSION_MAJOR, 1167 MOUNT_CIFS_VERSION_MINOR, 1168 MOUNT_CIFS_VENDOR_SUFFIX); 1182 case 'V': 1183 print_cifs_mount_version(); 1169 1184 exit (0); 1170 1185 case 'w': -
branches/samba-3.3.x/source/include/proto.h
r224 r342 6892 6892 char ***pnames, 6893 6893 enum lsa_SidType **ptypes); 6894 NTSTATUS rpccli_lsa_lookup_sids3(struct rpc_pipe_client *cli, 6895 TALLOC_CTX *mem_ctx, 6896 struct policy_handle *pol, 6897 int num_sids, 6898 const DOM_SID *sids, 6899 char ***pdomains, 6900 char ***pnames, 6901 enum lsa_SidType **ptypes); 6894 6902 NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli, 6895 6903 TALLOC_CTX *mem_ctx, … … 6900 6908 DOM_SID **sids, 6901 6909 enum lsa_SidType **types); 6910 NTSTATUS rpccli_lsa_lookup_names4(struct rpc_pipe_client *cli, 6911 TALLOC_CTX *mem_ctx, 6912 struct policy_handle *pol, int num_names, 6913 const char **names, 6914 const char ***dom_names, 6915 int level, 6916 DOM_SID **sids, 6917 enum lsa_SidType **types); 6918 6902 6919 bool fetch_domain_sid( char *domain, char *remote_machine, DOM_SID *psid); 6903 6920 … … 6989 7006 const struct ndr_syntax_id *interface, 6990 7007 struct rpc_pipe_client **presult); 7008 NTSTATUS cli_rpc_pipe_open_noauth_transport(struct cli_state *cli, 7009 enum dcerpc_transport_t transport, 7010 const struct ndr_syntax_id *interface, 7011 struct rpc_pipe_client **presult); 6991 7012 NTSTATUS cli_rpc_pipe_open_ntlmssp(struct cli_state *cli, 6992 7013 const struct ndr_syntax_id *interface, 7014 enum dcerpc_transport_t transport, 6993 7015 enum pipe_auth_level auth_level, 6994 7016 const char *domain, … … 6998 7020 NTSTATUS cli_rpc_pipe_open_spnego_ntlmssp(struct cli_state *cli, 6999 7021 const struct ndr_syntax_id *interface, 7022 enum dcerpc_transport_t transport, 7000 7023 enum pipe_auth_level auth_level, 7001 7024 const char *domain, … … 7009 7032 NTSTATUS cli_rpc_pipe_open_schannel_with_key(struct cli_state *cli, 7010 7033 const struct ndr_syntax_id *interface, 7034 enum dcerpc_transport_t transport, 7011 7035 enum pipe_auth_level auth_level, 7012 7036 const char *domain, … … 7015 7039 NTSTATUS cli_rpc_pipe_open_ntlmssp_auth_schannel(struct cli_state *cli, 7016 7040 const struct ndr_syntax_id *interface, 7041 enum dcerpc_transport_t transport, 7017 7042 enum pipe_auth_level auth_level, 7018 7043 const char *domain, … … 7022 7047 NTSTATUS cli_rpc_pipe_open_schannel(struct cli_state *cli, 7023 7048 const struct ndr_syntax_id *interface, 7049 enum dcerpc_transport_t transport, 7024 7050 enum pipe_auth_level auth_level, 7025 7051 const char *domain, -
branches/samba-3.3.x/source/include/rpc_dce.h
r206 r342 151 151 152 152 /* Maximum size of the signing data in a fragment. */ 153 #define RPC_MAX_SIGN_SIZE 0x 20 /* 32*/153 #define RPC_MAX_SIGN_SIZE 0x38 /* 56 */ 154 154 155 155 /* Maximum PDU fragment size. */ -
branches/samba-3.3.x/source/include/version.h
r338 r342 2 2 #define SAMBA_VERSION_MAJOR 3 3 3 #define SAMBA_VERSION_MINOR 3 4 #define SAMBA_VERSION_RELEASE 8 5 #define SAMBA_VERSION_OFFICIAL_STRING "3.3.8" 6 #define SAMBA_VERSION_VENDOR_SUFFIX "eCS 1.1.x-TEST" 7 #define SAMBA_VERSION_VENDOR_PATCH 20091006 8 #define SAMBA_VERSION_VENDOR_PATCH_STRING "20091006" 4 #define SAMBA_VERSION_RELEASE 9 5 #define SAMBA_VERSION_OFFICIAL_STRING "3.3.9" 9 6 #define SAMBA_VERSION_STRING samba_version_string() -
branches/samba-3.3.x/source/lib/smbldap.c
r274 r342 1466 1466 } 1467 1467 1468 DEBUG(3,("smbldap_search_paged: search was successful l\n"));1468 DEBUG(3,("smbldap_search_paged: search was successful\n")); 1469 1469 1470 1470 rc = ldap_parse_result(ldap_state->ldap_struct, *res, NULL, NULL, -
branches/samba-3.3.x/source/lib/system_smbd.c
r206 r342 160 160 int i; 161 161 162 max_grp = MIN( 32, groups_max());162 max_grp = MIN(128, groups_max()); 163 163 temp_groups = SMB_MALLOC_ARRAY(gid_t, max_grp); 164 164 if (! temp_groups) { -
branches/samba-3.3.x/source/libnet/libnet_join.c
r309 r342 1071 1071 1072 1072 status = cli_rpc_pipe_open_schannel_with_key( 1073 cli, &ndr_table_netlogon.syntax_id, PIPE_AUTH_LEVEL_PRIVACY, 1073 cli, &ndr_table_netlogon.syntax_id, NCACN_NP, 1074 PIPE_AUTH_LEVEL_PRIVACY, 1074 1075 netbios_domain_name, netlogon_pipe->dc, &pipe_hnd); 1075 1076 -
branches/samba-3.3.x/source/libsmb/async_smb.c
r221 r342 239 239 } 240 240 241 if ((raw_pdu_len == 4) && (CVAL(pdu, 0) == SMBkeepalive)) { 242 DEBUG(10, ("Got keepalive\n")); 243 TALLOC_FREE(pdu); 244 return; 245 } 246 241 247 /* 242 248 * TODO: Handle oplock break requests -
branches/samba-3.3.x/source/libsmb/clireadwrite.c
r206 r342 155 155 } 156 156 157 struct cli_readall_state { 158 struct cli_state *cli; 159 uint16_t fnum; 160 off_t start_offset; 161 size_t size; 162 size_t received; 163 uint8_t *buf; 164 }; 165 166 static void cli_readall_done(struct async_req *subreq); 167 168 static struct async_req *cli_readall_send(TALLOC_CTX *mem_ctx, 169 struct cli_state *cli, 170 uint16_t fnum, 171 off_t offset, size_t size) 172 { 173 struct async_req *req, *subreq; 174 struct cli_readall_state *state; 175 176 req = async_req_new(mem_ctx, cli->event_ctx); 177 if (req == NULL) { 178 return NULL; 179 } 180 state = talloc(req, struct cli_readall_state); 181 if (state == NULL) { 182 TALLOC_FREE(req); 183 return NULL; 184 } 185 req->private_data = state; 186 187 state->cli = cli; 188 state->fnum = fnum; 189 state->start_offset = offset; 190 state->size = size; 191 state->received = 0; 192 state->buf = NULL; 193 194 subreq = cli_read_andx_send(state, cli, fnum, offset, size); 195 if (subreq == NULL) { 196 TALLOC_FREE(req); 197 return NULL; 198 } 199 subreq->async.fn = cli_readall_done; 200 subreq->async.priv = req; 201 return req; 202 } 203 204 static void cli_readall_done(struct async_req *subreq) 205 { 206 struct async_req *req = talloc_get_type_abort( 207 subreq->async.priv, struct async_req); 208 struct cli_readall_state *state = talloc_get_type_abort( 209 req->private_data, struct cli_readall_state); 210 ssize_t received; 211 uint8_t *buf; 212 NTSTATUS status; 213 214 status = cli_read_andx_recv(subreq, &received, &buf); 215 if (!NT_STATUS_IS_OK(status)) { 216 async_req_error(req, status); 217 return; 218 } 219 220 if (received == 0) { 221 /* EOF */ 222 async_req_done(req); 223 return; 224 } 225 226 if ((state->received == 0) && (received == state->size)) { 227 /* Ideal case: Got it all in one run */ 228 state->buf = buf; 229 state->received += received; 230 async_req_done(req); 231 return; 232 } 233 234 /* 235 * We got a short read, issue a read for the 236 * rest. Unfortunately we have to allocate the buffer 237 * ourselves now, as our caller expects to receive a single 238 * buffer. cli_read_andx does it from the buffer received from 239 * the net, but with a short read we have to put it together 240 * from several reads. 241 */ 242 243 if (state->buf == NULL) { 244 state->buf = talloc_array(state, uint8_t, state->size); 245 if (async_req_nomem(state->buf, req)) { 246 return; 247 } 248 } 249 memcpy(state->buf + state->received, buf, received); 250 state->received += received; 251 252 TALLOC_FREE(subreq); 253 254 if (state->received >= state->size) { 255 async_req_done(req); 256 return; 257 } 258 259 subreq = cli_read_andx_send(state, state->cli, state->fnum, 260 state->start_offset + state->received, 261 state->size - state->received); 262 if (async_req_nomem(subreq, req)) { 263 return; 264 } 265 subreq->async.fn = cli_readall_done; 266 subreq->async.priv = req; 267 } 268 269 static NTSTATUS cli_readall_recv(struct async_req *req, ssize_t *received, 270 uint8_t **rcvbuf) 271 { 272 struct cli_readall_state *state = talloc_get_type_abort( 273 req->private_data, struct cli_readall_state); 274 275 SMB_ASSERT(req->state >= ASYNC_REQ_DONE); 276 if (req->state == ASYNC_REQ_ERROR) { 277 return req->status; 278 } 279 *received = state->received; 280 *rcvbuf = state->buf; 281 return NT_STATUS_OK; 282 } 283 157 284 /* 158 285 * Parallel read support. … … 163 290 */ 164 291 292 struct cli_pull_subreq { 293 struct async_req *req; 294 size_t received; 295 uint8_t *buf; 296 }; 297 165 298 struct cli_pull_state { 166 299 struct async_req *req; … … 180 313 */ 181 314 int num_reqs; 182 struct async_req **reqs;315 struct cli_pull_subreq *reqs; 183 316 184 317 /* … … 269 402 state->num_reqs = MIN(state->num_reqs, cli->max_mux); 270 403 271 state->reqs = TALLOC_ZERO_ARRAY(state, struct async_req *,404 state->reqs = TALLOC_ZERO_ARRAY(state, struct cli_pull_subreq, 272 405 state->num_reqs); 273 406 if (state->reqs == NULL) { … … 289 422 request_thistime = MIN(size_left, state->chunk_size); 290 423 291 state->reqs[i] = cli_read_andx_send(424 state->reqs[i].req = cli_readall_send( 292 425 state->reqs, cli, fnum, 293 426 state->start_offset + state->requested, 294 427 request_thistime); 295 428 296 if (state->reqs[i] == NULL) {429 if (state->reqs[i].req == NULL) { 297 430 goto failed; 298 431 } 299 432 300 state->reqs[i] ->async.fn = cli_pull_read_done;301 state->reqs[i] ->async.priv = result;433 state->reqs[i].req->async.fn = cli_pull_read_done; 434 state->reqs[i].req->async.priv = result; 302 435 303 436 state->requested += request_thistime; … … 321 454 struct cli_pull_state *state = talloc_get_type_abort( 322 455 pull_req->private_data, struct cli_pull_state); 323 struct cli_request *read_state = cli_request_get(read_req); 456 ssize_t received; 457 uint8_t *buf; 324 458 NTSTATUS status; 325 326 status = cli_read_andx_recv(read_req, &read_state->data.read.received, 327 &read_state->data.read.rcvbuf);459 int i; 460 461 status = cli_readall_recv(read_req, &received, &buf); 328 462 if (!NT_STATUS_IS_OK(status)) { 329 463 async_req_error(state->req, status); 330 464 return; 331 465 } 466 467 for (i=0; i<state->num_reqs; i++) { 468 if (state->reqs[i].req == read_req) { 469 break; 470 } 471 } 472 473 if (i == state->num_reqs) { 474 /* Got something we did not send. Just drop it. */ 475 TALLOC_FREE(read_req); 476 return; 477 } 478 479 state->reqs[i].received = received; 480 state->reqs[i].buf = buf; 332 481 333 482 /* … … 340 489 */ 341 490 342 while (state->reqs[state->top_req] != NULL) {343 struct cli_ request*top_read;491 while (state->reqs[state->top_req].req != NULL) { 492 struct cli_pull_subreq *top_read; 344 493 345 494 DEBUG(11, ("cli_pull_read_done: top_req = %d\n", 346 495 state->top_req)); 347 496 348 if (state->reqs[state->top_req] ->state < ASYNC_REQ_DONE) {497 if (state->reqs[state->top_req].req->state < ASYNC_REQ_DONE) { 349 498 DEBUG(11, ("cli_pull_read_done: top request not yet " 350 499 "done\n")); … … 352 501 } 353 502 354 top_read = cli_request_get(state->reqs[state->top_req]);503 top_read = &state->reqs[state->top_req]; 355 504 356 505 DEBUG(10, ("cli_pull_read_done: Pushing %d bytes, %d already " 357 "pushed\n", (int)top_read-> data.read.received,506 "pushed\n", (int)top_read->received, 358 507 (int)state->pushed)); 359 508 360 status = state->sink((char *)top_read->data.read.rcvbuf, 361 top_read->data.read.received, 509 status = state->sink((char *)top_read->buf, top_read->received, 362 510 state->priv); 363 511 if (!NT_STATUS_IS_OK(status)) { … … 365 513 return; 366 514 } 367 state->pushed += top_read-> data.read.received;368 369 TALLOC_FREE(state->reqs[state->top_req] );515 state->pushed += top_read->received; 516 517 TALLOC_FREE(state->reqs[state->top_req].req); 370 518 371 519 if (state->requested < state->size) { … … 384 532 state->top_req)); 385 533 386 new_req = cli_read _andx_send(534 new_req = cli_readall_send( 387 535 state->reqs, state->cli, state->fnum, 388 536 state->start_offset + state->requested, … … 396 544 new_req->async.priv = pull_req; 397 545 398 state->reqs[state->top_req] = new_req;546 state->reqs[state->top_req].req = new_req; 399 547 state->requested += request_thistime; 400 548 } -
branches/samba-3.3.x/source/libsmb/dsgetdcname.c
r223 r342 627 627 struct ip_service_name *r = &dclist[count]; 628 628 629 r->port = dcs[ count].port;630 r->hostname = dcs[ count].hostname;629 r->port = dcs[i].port; 630 r->hostname = dcs[i].hostname; 631 631 632 632 /* If we don't have an IP list for a name, lookup it up */ -
branches/samba-3.3.x/source/libsmb/libsmb_context.c
r222 r342 656 656 const char *signing_state = "off"; 657 657 658 if (!context || 659 ! workgroup || ! *workgroup || 660 ! user || ! *user || 661 ! password || ! *password) { 658 if (! context) { 662 659 663 660 return; 664 661 } 665 662 663 if (! workgroup || ! *workgroup) { 664 workgroup = smbc_getWorkgroup(context); 665 } 666 667 if (! user) { 668 user = smbc_getUser(context); 669 } 670 671 if (! password) { 672 password = ""; 673 } 674 666 675 if (smbc_getOptionUseKerberos(context)) { 667 676 use_kerberos = True; -
branches/samba-3.3.x/source/libsmb/libsmb_dir.c
r223 r342 626 626 * Get the backup list ... 627 627 */ 628 if (!name_status_find(server, 0 ,0,628 if (!name_status_find(server, 0x20, 0x20, 629 629 &rem_ss, buserver)) { 630 630 -
branches/samba-3.3.x/source/libsmb/namequery.c
r221 r342 409 409 410 410 for (i=0;i<count;i++) { 411 if (status[i].type == type) 411 /* Find first one of the requested type that's not a GROUP. */ 412 if (status[i].type == type && ! (status[i].flags & 0x80)) 412 413 break; 413 414 } -
branches/samba-3.3.x/source/libsmb/passchange.c
r309 r342 153 153 result = cli_rpc_pipe_open_ntlmssp(cli, 154 154 &ndr_table_samr.syntax_id, 155 NCACN_NP, 155 156 PIPE_AUTH_LEVEL_PRIVACY, 156 157 "", /* what domain... ? */ -
branches/samba-3.3.x/source/locking/brlock.c
r224 r342 372 372 ****************************************************************************/ 373 373 374 static unsigned int brlock_posix_split_merge(struct lock_struct *lck_arr, /* Output array. */ 375 const struct lock_struct *ex, /* existing lock. */ 376 const struct lock_struct *plock, /* proposed lock. */ 377 bool *lock_was_added) 374 static unsigned int brlock_posix_split_merge(struct lock_struct *lck_arr, /* Output array. */ 375 struct lock_struct *ex, /* existing lock. */ 376 struct lock_struct *plock) /* proposed lock. */ 378 377 { 379 378 bool lock_types_differ = (ex->lock_type != plock->lock_type); … … 392 391 393 392 /********************************************* 394 395 396 397 398 399 393 +---------+ 394 | ex | 395 +---------+ 396 +-------+ 397 | plock | 398 +-------+ 400 399 OR.... 401 402 403 400 +---------+ 401 | ex | 402 +---------+ 404 403 **********************************************/ 405 404 406 405 if ( (ex->start > (plock->start + plock->size)) || 407 (plock->start > (ex->start + ex->size))) { 406 (plock->start > (ex->start + ex->size))) { 407 408 408 /* No overlap with this lock - copy existing. */ 409 409 410 memcpy(&lck_arr[0], ex, sizeof(struct lock_struct)); 410 411 return 1; … … 418 419 | plock | -> replace with plock. 419 420 +---------------------------+ 421 OR 422 +---------------+ 423 | ex | 424 +---------------+ 425 +---------------------------+ 426 | plock | -> replace with plock. 427 +---------------------------+ 428 420 429 **********************************************/ 421 430 422 431 if ( (ex->start >= plock->start) && 423 (ex->start + ex->size <= plock->start + plock->size) ) { 424 memcpy(&lck_arr[0], plock, sizeof(struct lock_struct)); 425 *lock_was_added = True; 426 return 1; 432 (ex->start + ex->size <= plock->start + plock->size) ) { 433 434 /* Replace - discard existing lock. */ 435 436 return 0; 427 437 } 428 438 429 439 /********************************************* 440 Adjacent after. 441 +-------+ 442 | ex | 443 +-------+ 444 +---------------+ 445 | plock | 446 +---------------+ 447 448 BECOMES.... 449 +---------------+-------+ 450 | plock | ex | - different lock types. 451 +---------------+-------+ 452 OR.... (merge) 453 +-----------------------+ 454 | plock | - same lock type. 455 +-----------------------+ 456 **********************************************/ 457 458 if (plock->start + plock->size == ex->start) { 459 460 /* If the lock types are the same, we merge, if different, we 461 add the remainder of the old lock. */ 462 463 if (lock_types_differ) { 464 /* Add existing. */ 465 memcpy(&lck_arr[0], ex, sizeof(struct lock_struct)); 466 return 1; 467 } else { 468 /* Merge - adjust incoming lock as we may have more 469 * merging to come. */ 470 plock->size += ex->size; 471 return 0; 472 } 473 } 474 475 /********************************************* 476 Adjacent before. 477 +-------+ 478 | ex | 479 +-------+ 480 +---------------+ 481 | plock | 482 +---------------+ 483 BECOMES.... 484 +-------+---------------+ 485 | ex | plock | - different lock types 486 +-------+---------------+ 487 488 OR.... (merge) 489 +-----------------------+ 490 | plock | - same lock type. 491 +-----------------------+ 492 493 **********************************************/ 494 495 if (ex->start + ex->size == plock->start) { 496 497 /* If the lock types are the same, we merge, if different, we 498 add the existing lock. */ 499 500 if (lock_types_differ) { 501 memcpy(&lck_arr[0], ex, sizeof(struct lock_struct)); 502 return 1; 503 } else { 504 /* Merge - adjust incoming lock as we may have more 505 * merging to come. */ 506 plock->start = ex->start; 507 plock->size += ex->size; 508 return 0; 509 } 510 } 511 512 /********************************************* 513 Overlap after. 430 514 +-----------------------+ 431 515 | ex | … … 434 518 | plock | 435 519 +---------------+ 436 OR ....437 +-------+438 | ex|439 +-------+520 OR 521 +----------------+ 522 | ex | 523 +----------------+ 440 524 +---------------+ 441 525 | plock | … … 448 532 OR.... (merge) 449 533 +-----------------------+ 450 | ex| - same lock type.534 | plock | - same lock type. 451 535 +-----------------------+ 452 536 **********************************************/ 453 537 454 538 if ( (ex->start >= plock->start) && 455 (ex->start <= plock->start + plock->size) && 456 (ex->start + ex->size > plock->start + plock->size) ) { 457 458 *lock_was_added = True; 539 (ex->start <= plock->start + plock->size) && 540 (ex->start + ex->size > plock->start + plock->size) ) { 459 541 460 542 /* If the lock types are the same, we merge, if different, we 461 add the new lock before the old. */543 add the remainder of the old lock. */ 462 544 463 545 if (lock_types_differ) { 464 /* Add new. */ 465 memcpy(&lck_arr[0], plock, sizeof(struct lock_struct)); 466 memcpy(&lck_arr[1], ex, sizeof(struct lock_struct)); 546 /* Add remaining existing. */ 547 memcpy(&lck_arr[0], ex, sizeof(struct lock_struct)); 467 548 /* Adjust existing start and size. */ 468 lck_arr[ 1].start = plock->start + plock->size;469 lck_arr[ 1].size = (ex->start + ex->size) - (plock->start + plock->size);470 return 2;549 lck_arr[0].start = plock->start + plock->size; 550 lck_arr[0].size = (ex->start + ex->size) - (plock->start + plock->size); 551 return 1; 471 552 } else { 472 /* Merge. */ 473 memcpy(&lck_arr[0], plock, sizeof(struct lock_struct)); 474 /* Set new start and size. */ 475 lck_arr[0].start = plock->start; 476 lck_arr[0].size = (ex->start + ex->size) - plock->start; 477 return 1; 553 /* Merge - adjust incoming lock as we may have more 554 * merging to come. */ 555 plock->size += (ex->start + ex->size) - (plock->start + plock->size); 556 return 0; 478 557 } 479 558 } 480 559 481 560 /********************************************* 482 +-----------------------+ 483 | ex | 484 +-----------------------+ 485 +---------------+ 486 | plock | 487 +---------------+ 488 OR.... 489 +-------+ 490 | ex | 491 +-------+ 492 +---------------+ 493 | plock | 494 +---------------+ 561 Overlap before. 562 +-----------------------+ 563 | ex | 564 +-----------------------+ 565 +---------------+ 566 | plock | 567 +---------------+ 568 OR 569 +-------------+ 570 | ex | 571 +-------------+ 572 +---------------+ 573 | plock | 574 +---------------+ 575 495 576 BECOMES.... 496 +-------+---------------+497 | ex | plock | - different lock types498 +-------+---------------+577 +-------+---------------+ 578 | ex | plock | - different lock types 579 +-------+---------------+ 499 580 500 581 OR.... (merge) 501 +-----------------------+502 | ex| - same lock type.503 +-----------------------+582 +-----------------------+ 583 | plock | - same lock type. 584 +-----------------------+ 504 585 505 586 **********************************************/ … … 509 590 (ex->start + ex->size <= plock->start + plock->size) ) { 510 591 511 *lock_was_added = True;512 513 592 /* If the lock types are the same, we merge, if different, we 514 add the new lock after the old. */593 add the truncated old lock. */ 515 594 516 595 if (lock_types_differ) { 517 596 memcpy(&lck_arr[0], ex, sizeof(struct lock_struct)); 518 memcpy(&lck_arr[1], plock, sizeof(struct lock_struct));519 597 /* Adjust existing size. */ 520 598 lck_arr[0].size = plock->start - ex->start; 521 return 2;599 return 1; 522 600 } else { 523 /* Merge . */524 memcpy(&lck_arr[0], ex, sizeof(struct lock_struct));525 /* Adjust existing size. */526 lck_arr[0].size = (plock->start + plock->size) -ex->start;527 return 1;601 /* Merge - adjust incoming lock as we may have more 602 * merging to come. MUST ADJUST plock SIZE FIRST ! */ 603 plock->size += (plock->start - ex->start); 604 plock->start = ex->start; 605 return 0; 528 606 } 529 607 } 530 608 531 609 /********************************************* 610 Complete overlap. 532 611 +---------------------------+ 533 612 | ex | … … 542 621 OR 543 622 +---------------------------+ 544 | ex| - same lock type.623 | plock | - same lock type. 545 624 +---------------------------+ 546 625 **********************************************/ 547 626 548 627 if ( (ex->start < plock->start) && (ex->start + ex->size > plock->start + plock->size) ) { 549 *lock_was_added = True;550 628 551 629 if (lock_types_differ) { … … 554 632 555 633 memcpy(&lck_arr[0], ex, sizeof(struct lock_struct)); 556 memcpy(&lck_arr[1], plock, sizeof(struct lock_struct)); 557 memcpy(&lck_arr[2], ex, sizeof(struct lock_struct)); 634 memcpy(&lck_arr[1], ex, sizeof(struct lock_struct)); 558 635 559 636 /* Adjust first existing size. */ … … 561 638 562 639 /* Adjust second existing start and size. */ 563 lck_arr[ 2].start = plock->start + plock->size;564 lck_arr[ 2].size = (ex->start + ex->size) - (plock->start + plock->size);565 return 3;640 lck_arr[1].start = plock->start + plock->size; 641 lck_arr[1].size = (ex->start + ex->size) - (plock->start + plock->size); 642 return 2; 566 643 } else { 567 /* Just eat plock. */ 568 memcpy(&lck_arr[0], ex, sizeof(struct lock_struct)); 569 return 1; 644 /* Just eat the existing locks, merge them into plock. */ 645 plock->start = ex->start; 646 plock->size = ex->size; 647 return 0; 570 648 } 571 649 } … … 591 669 struct lock_struct *locks = br_lck->lock_data; 592 670 struct lock_struct *tp; 593 bool lock_was_added = False;594 671 bool signal_pending_read = False; 595 672 … … 613 690 return NT_STATUS_NO_MEMORY; 614 691 } 615 692 616 693 count = 0; 694 617 695 for (i=0; i < br_lck->num_locks; i++) { 618 696 struct lock_struct *curr_lock = &locks[i]; … … 649 727 650 728 /* Work out overlaps. */ 651 count += brlock_posix_split_merge(&tp[count], curr_lock, plock, &lock_was_added); 652 } 653 } 654 655 if (!lock_was_added) { 656 memcpy(&tp[count], plock, sizeof(struct lock_struct)); 657 count++; 658 } 729 count += brlock_posix_split_merge(&tp[count], curr_lock, plock); 730 } 731 } 732 733 /* Try and add the lock in order, sorted by lock start. */ 734 for (i=0; i < count; i++) { 735 struct lock_struct *curr_lock = &tp[i]; 736 737 if (curr_lock->start <= plock->start) { 738 continue; 739 } 740 } 741 742 if (i < count) { 743 memmove(&tp[i+1], &tp[i], 744 (count - i)*sizeof(struct lock_struct)); 745 } 746 memcpy(&tp[i], plock, sizeof(struct lock_struct)); 747 count++; 659 748 660 749 /* We can get the POSIX lock, now see if it needs to … … 688 777 } 689 778 690 /* Realloc so we don't leak entries per lock call. */ 691 tp = (struct lock_struct *)SMB_REALLOC(tp, count * sizeof(*locks)); 692 if (!tp) { 693 return NT_STATUS_NO_MEMORY; 694 } 779 /* If we didn't use all the allocated size, 780 * Realloc so we don't leak entries per lock call. */ 781 if (count < br_lck->num_locks + 2) { 782 tp = (struct lock_struct *)SMB_REALLOC(tp, count * sizeof(*locks)); 783 if (!tp) { 784 return NT_STATUS_NO_MEMORY; 785 } 786 } 787 695 788 br_lck->num_locks = count; 696 789 SAFE_FREE(br_lck->lock_data); … … 891 984 static bool brl_unlock_posix(struct messaging_context *msg_ctx, 892 985 struct byte_range_lock *br_lck, 893 conststruct lock_struct *plock)986 struct lock_struct *plock) 894 987 { 895 988 unsigned int i, j, count; … … 923 1016 for (i = 0; i < br_lck->num_locks; i++) { 924 1017 struct lock_struct *lock = &locks[i]; 925 struct lock_struct tmp_lock[3];926 bool lock_was_added = False;927 1018 unsigned int tmp_count; 928 1019 … … 935 1026 } 936 1027 937 /* Work out overlaps. */ 938 tmp_count = brlock_posix_split_merge(&tmp_lock[0], &locks[i], plock, &lock_was_added); 939 940 if (tmp_count == 1) { 941 /* Ether the locks didn't overlap, or the unlock completely 942 overlapped this lock. If it didn't overlap, then there's 943 no change in the locks. */ 944 if (tmp_lock[0].lock_type != UNLOCK_LOCK) { 945 SMB_ASSERT(tmp_lock[0].lock_type == locks[i].lock_type); 946 /* No change in this lock. */ 947 memcpy(&tp[count], &tmp_lock[0], sizeof(struct lock_struct)); 948 count++; 949 } else { 950 SMB_ASSERT(tmp_lock[0].lock_type == UNLOCK_LOCK); 951 overlap_found = True; 1028 if (lock->lock_flav == WINDOWS_LOCK) { 1029 /* Do any Windows flavour locks conflict ? */ 1030 if (brl_conflict(lock, plock)) { 1031 SAFE_FREE(tp); 1032 return false; 952 1033 } 953 continue; 954 } else if (tmp_count == 2) { 955 /* The unlock overlapped an existing lock. Copy the truncated 956 lock into the lock array. */ 957 if (tmp_lock[0].lock_type != UNLOCK_LOCK) { 958 SMB_ASSERT(tmp_lock[0].lock_type == locks[i].lock_type); 959 SMB_ASSERT(tmp_lock[1].lock_type == UNLOCK_LOCK); 960 memcpy(&tp[count], &tmp_lock[0], sizeof(struct lock_struct)); 961 if (tmp_lock[0].size != locks[i].size) { 962 overlap_found = True; 963 } 964 } else { 965 SMB_ASSERT(tmp_lock[0].lock_type == UNLOCK_LOCK); 966 SMB_ASSERT(tmp_lock[1].lock_type == locks[i].lock_type); 967 memcpy(&tp[count], &tmp_lock[1], sizeof(struct lock_struct)); 968 if (tmp_lock[1].start != locks[i].start) { 969 overlap_found = True; 970 } 971 } 1034 /* Just copy the Windows lock into the new array. */ 1035 memcpy(&tp[count], lock, sizeof(struct lock_struct)); 972 1036 count++; 973 1037 continue; 974 } else { 975 /* tmp_count == 3 - (we split a lock range in two). */ 976 SMB_ASSERT(tmp_lock[0].lock_type == locks[i].lock_type); 977 SMB_ASSERT(tmp_lock[1].lock_type == UNLOCK_LOCK); 978 SMB_ASSERT(tmp_lock[2].lock_type == locks[i].lock_type); 979 980 memcpy(&tp[count], &tmp_lock[0], sizeof(struct lock_struct)); 981 count++; 982 memcpy(&tp[count], &tmp_lock[2], sizeof(struct lock_struct)); 983 count++; 984 overlap_found = True; 1038 } 1039 1040 /* Work out overlaps. */ 1041 tmp_count = brlock_posix_split_merge(&tp[count], lock, plock); 1042 1043 if (tmp_count == 0) { 1044 /* plock overlapped the existing lock completely, 1045 or replaced it. Don't copy the existing lock. */ 1046 overlap_found = true; 1047 } else if (tmp_count == 1) { 1048 /* Either no overlap, (simple copy of existing lock) or 1049 * an overlap of an existing lock. */ 1050 /* If the lock changed size, we had an overlap. */ 1051 if (tp[count].size != lock->size) { 1052 overlap_found = true; 1053 } 1054 count += tmp_count; 1055 } else if (tmp_count == 2) { 1056 /* We split a lock range in two. */ 1057 overlap_found = true; 1058 count += tmp_count; 1059 985 1060 /* Optimisation... */ 986 1061 /* We know we're finished here as we can't overlap any 987 1062 more POSIX locks. Copy the rest of the lock array. */ 1063 988 1064 if (i < br_lck->num_locks - 1) { 989 memcpy(&tp[count], &locks[i+1], 1065 memcpy(&tp[count], &locks[i+1], 990 1066 sizeof(*locks)*((br_lck->num_locks-1) - i)); 991 1067 count += ((br_lck->num_locks-1) - i); … … 993 1069 break; 994 1070 } 1071 995 1072 } 996 1073 -
branches/samba-3.3.x/source/modules/vfs_default.c
r221 r342 994 994 } 995 995 else { 996 ret = SMB_VFS_STAT(handle->conn, fname, &sbuf); 996 if (lp_posix_pathnames()) { 997 ret = SMB_VFS_LSTAT(handle->conn, fname, &sbuf); 998 } else { 999 ret = SMB_VFS_STAT(handle->conn, fname, &sbuf); 1000 } 997 1001 } 998 1002 -
branches/samba-3.3.x/source/nsswitch/libwbclient/wbc_pam.c
r206 r342 440 440 MIN(params->password.response.lm_length, 441 441 sizeof(request.data.auth_crap.lm_resp)); 442 request.data.auth_crap.nt_resp_len =443 MIN(params->password.response.nt_length,444 sizeof(request.data.auth_crap.nt_resp));445 442 if (params->password.response.lm_data) { 446 443 memcpy(request.data.auth_crap.lm_resp, … … 448 445 request.data.auth_crap.lm_resp_len); 449 446 } 450 if (params->password.response.nt_data) { 447 request.data.auth_crap.nt_resp_len = params->password.response.nt_length; 448 if (params->password.response.nt_length > sizeof(request.data.auth_crap.nt_resp)) { 449 request.flags |= WBFLAG_BIG_NTLMV2_BLOB; 450 request.extra_len = params->password.response.nt_length; 451 request.extra_data.data = talloc_zero_array(NULL, char, request.extra_len); 452 if (request.extra_data.data == NULL) { 453 wbc_status = WBC_ERR_NO_MEMORY; 454 BAIL_ON_WBC_ERROR(wbc_status); 455 } 456 memcpy(request.extra_data.data, 457 params->password.response.nt_data, 458 request.data.auth_crap.nt_resp_len); 459 } else if (params->password.response.nt_data) { 451 460 memcpy(request.data.auth_crap.nt_resp, 452 461 params->password.response.nt_data, … … 493 502 if (response.extra_data.data) 494 503 free(response.extra_data.data); 504 505 talloc_free(request.extra_data.data); 495 506 496 507 return wbc_status; -
branches/samba-3.3.x/source/nsswitch/libwbclient/wbc_sid.c
r206 r342 282 282 if (pdomain != NULL) { 283 283 *pdomain = domain; 284 } else { 285 talloc_free(domain); 284 286 } 285 287 if (pname != NULL) { 286 288 *pname = name; 289 } else { 290 talloc_free(name); 287 291 } 288 292 if (pname_type != NULL) { -
branches/samba-3.3.x/source/nsswitch/libwbclient/wbc_util.c
r206 r342 285 285 BAIL_ON_WBC_ERROR(wbc_status); 286 286 } 287 288 ZERO_STRUCTP(info); 287 289 288 290 r = info_string; -
branches/samba-3.3.x/source/nsswitch/pam_winbind.c
r309 r342 3057 3057 pass_new, pwdlastset_update); 3058 3058 if (ret) { 3059 _pam_overwrite(pass_new);3060 _pam_overwrite(pass_old);3061 3059 pass_old = pass_new = NULL; 3062 3060 goto out; … … 3087 3085 &error, &info, &policy, 3088 3086 NULL, &username_ret); 3089 _pam_overwrite(pass_new);3090 _pam_overwrite(pass_old);3091 3087 pass_old = pass_new = NULL; 3092 3088 -
branches/samba-3.3.x/source/pam_smbpass/pam_smb_auth.c
r206 r342 180 180 retval = PAM_SUCCESS; 181 181 182 pam_get_data(pamh, "smb_setcred_return", (const void **)&pretval);182 _pam_get_data(pamh, "smb_setcred_return", &pretval); 183 183 if(pretval) { 184 184 retval = *pretval; … … 200 200 201 201 /* Get the authtok; if we don't have one, silently fail. */ 202 retval = pam_get_item( pamh, PAM_AUTHTOK, (const void **)&pass );202 retval = _pam_get_item( pamh, PAM_AUTHTOK, &pass ); 203 203 204 204 if (retval != PAM_SUCCESS) { -
branches/samba-3.3.x/source/pam_smbpass/pam_smb_passwd.c
r206 r342 230 230 231 231 if (off( SMB_NOT_SET_PASS, ctrl )) { 232 retval = pam_get_item( pamh, PAM_OLDAUTHTOK,233 (const void **)&pass_old );232 retval = _pam_get_item( pamh, PAM_OLDAUTHTOK, 233 &pass_old ); 234 234 } else { 235 retval = pam_get_data( pamh, _SMB_OLD_AUTHTOK,236 (const void **)&pass_old );235 retval = _pam_get_data( pamh, _SMB_OLD_AUTHTOK, 236 &pass_old ); 237 237 if (retval == PAM_NO_MODULE_DATA) { 238 238 pass_old = NULL; -
branches/samba-3.3.x/source/pam_smbpass/support.c
r206 r342 84 84 struct pam_conv *conv; 85 85 86 retval = pam_get_item(pamh, PAM_CONV, (const void **)&conv);86 retval = _pam_get_item(pamh, PAM_CONV, &conv); 87 87 if (retval == PAM_SUCCESS) { 88 88 … … 277 277 /* log the number of authentication failures */ 278 278 if (failure->count != 0) { 279 pam_get_item( pamh, PAM_SERVICE, (const void **)&service );279 _pam_get_item( pamh, PAM_SERVICE, &service ); 280 280 _log_err( LOG_NOTICE 281 281 , "%d authentication %s " … … 333 333 const char *service; 334 334 335 pam_get_item( pamh, PAM_SERVICE, (const void **)&service );335 _pam_get_item( pamh, PAM_SERVICE, &service ); 336 336 _log_err( LOG_NOTICE, "failed auth request by %s for service %s as %s", 337 337 uidtoname(getuid()), service ? service : "**unknown**", name); … … 368 368 const char *service; 369 369 370 pam_get_item( pamh, PAM_SERVICE, (const void **)&service );370 _pam_get_item( pamh, PAM_SERVICE, &service ); 371 371 372 372 if (data_name != NULL) { … … 381 381 382 382 /* any previous failures for this user ? */ 383 pam_get_data(pamh, data_name, (const void **)&old);383 _pam_get_data(pamh, data_name, &old); 384 384 385 385 if (old != NULL) { … … 486 486 487 487 if (on(SMB_TRY_FIRST_PASS, ctrl) || on(SMB_USE_FIRST_PASS, ctrl)) { 488 retval = pam_get_item( pamh, authtok_flag, (const void **)&item );488 retval = _pam_get_item( pamh, authtok_flag, &item ); 489 489 if (retval != PAM_SUCCESS) { 490 490 /* very strange. */ … … 579 579 _pam_delete( token ); /* clean it up */ 580 580 if (retval != PAM_SUCCESS 581 || (retval = pam_get_item( pamh, authtok_flag582 , (const void **)&item )) != PAM_SUCCESS)581 || (retval = _pam_get_item( pamh, authtok_flag 582 ,&item )) != PAM_SUCCESS) 583 583 { 584 584 _log_err( LOG_CRIT, "error manipulating password" ); … … 593 593 retval = pam_set_data( pamh, data_name, (void *) token, _cleanup ); 594 594 if (retval != PAM_SUCCESS 595 || (retval = pam_get_data( pamh, data_name, (const void **)&item ))595 || (retval = _pam_get_data( pamh, data_name, &item )) 596 596 != PAM_SUCCESS) 597 597 { … … 631 631 return PAM_SUCCESS; 632 632 } 633 634 /* 635 * Work around the pam API that has functions with void ** as parameters 636 * These lead to strict aliasing warnings with gcc. 637 */ 638 int _pam_get_item(const pam_handle_t *pamh, 639 int item_type, 640 const void *_item) 641 { 642 const void **item = (const void **)_item; 643 return pam_get_item(pamh, item_type, item); 644 } 645 646 int _pam_get_data(const pam_handle_t *pamh, 647 const char *module_data_name, 648 const void *_data) 649 { 650 const void **data = (const void **)_data; 651 return pam_get_data(pamh, module_data_name, data); 652 } -
branches/samba-3.3.x/source/pam_smbpass/support.h
r206 r342 49 49 extern int _pam_smb_approve_pass(pam_handle_t *, unsigned int, const char *, 50 50 const char *); 51 52 int _pam_get_item(const pam_handle_t *pamh, 53 int item_type, 54 const void *_item); 55 int _pam_get_data(const pam_handle_t *pamh, 56 const char *module_data_name, 57 const void *_data); -
branches/samba-3.3.x/source/passdb/lookup_sid.c
r274 r342 1086 1086 DATA_BLOB cache_value; 1087 1087 1088 if (!memcache_lookup(NULL, SID_ UID_CACHE,1088 if (!memcache_lookup(NULL, SID_GID_CACHE, 1089 1089 data_blob_const(psid, ndr_size_dom_sid(psid, 0)), 1090 1090 &cache_value)) { -
branches/samba-3.3.x/source/passdb/pdb_ldap.c
r274 r342 1701 1701 char *utf8_dn; 1702 1702 size_t converted_size; 1703 int ret; 1703 1704 1704 1705 if (!ldap_state->is_nds_ldap) { … … 1732 1733 1733 1734 if ((ber_printf (ber, "{") < 0) || 1734 (ber_printf (ber, "ts", LDAP_TAG_EXOP_MODIFY_PASSWD_ID, utf8_dn) < 0) || 1735 (ber_printf (ber, "ts", LDAP_TAG_EXOP_MODIFY_PASSWD_NEW, utf8_password) < 0) || 1736 (ber_printf (ber, "n}") < 0)) { 1737 DEBUG(0,("ldapsam_modify_entry: ber_printf returns a value <0\n")); 1738 ber_free(ber,1); 1739 SAFE_FREE(utf8_dn); 1740 SAFE_FREE(utf8_password); 1741 return NT_STATUS_UNSUCCESSFUL; 1735 (ber_printf (ber, "ts", LDAP_TAG_EXOP_MODIFY_PASSWD_ID, 1736 utf8_dn) < 0)) { 1737 DEBUG(0,("ldapsam_modify_entry: ber_printf returns a " 1738 "value <0\n")); 1739 ber_free(ber,1); 1740 SAFE_FREE(utf8_dn); 1741 SAFE_FREE(utf8_password); 1742 return NT_STATUS_UNSUCCESSFUL; 1743 } 1744 1745 if ((utf8_password != NULL) && (*utf8_password != '\0')) { 1746 ret = ber_printf(ber, "ts}", 1747 LDAP_TAG_EXOP_MODIFY_PASSWD_NEW, 1748 utf8_password); 1749 } else { 1750 ret = ber_printf(ber, "}"); 1751 } 1752 1753 if (ret < 0) { 1754 DEBUG(0,("ldapsam_modify_entry: ber_printf returns a " 1755 "value <0\n")); 1756 ber_free(ber,1); 1757 SAFE_FREE(utf8_dn); 1758 SAFE_FREE(utf8_password); 1759 return NT_STATUS_UNSUCCESSFUL; 1742 1760 } 1743 1761 -
branches/samba-3.3.x/source/profile/profile.c
r206 r342 228 228 profile_h = (struct profile_header *)shmat(shm_id, 0, 229 229 read_only?SHM_RDONLY:0); 230 if ((long)profile_ p== -1) {230 if ((long)profile_h == -1) { 231 231 DEBUG(0,("Can't attach to IPC area. Error was %s\n", 232 232 strerror(errno))); -
branches/samba-3.3.x/source/rpc_client/cli_lsarpc.c
r206 r342 127 127 char **domains, 128 128 char **names, 129 enum lsa_SidType *types) 129 enum lsa_SidType *types, 130 bool use_lookupsids3) 130 131 { 131 132 NTSTATUS result = NT_STATUS_OK; … … 160 161 } 161 162 162 result = rpccli_lsa_LookupSids(cli, mem_ctx, 163 pol, 164 &sid_array, 165 &ref_domains, 166 &lsa_names, 167 level, 168 &count); 163 if (use_lookupsids3) { 164 struct lsa_TransNameArray2 lsa_names2; 165 uint32_t n; 166 167 ZERO_STRUCT(lsa_names2); 168 169 result = rpccli_lsa_LookupSids3(cli, mem_ctx, 170 &sid_array, 171 &ref_domains, 172 &lsa_names2, 173 level, 174 &count, 175 0, 176 0); 177 178 if (!NT_STATUS_IS_ERR(result)) { 179 lsa_names.count = lsa_names2.count; 180 lsa_names.names = talloc_array(mem_ctx, struct lsa_TranslatedName, lsa_names.count); 181 if (!lsa_names.names) { 182 return NT_STATUS_NO_MEMORY; 183 } 184 for (n=0; n < lsa_names.count; n++) { 185 lsa_names.names[n].sid_type = lsa_names2.names[n].sid_type; 186 lsa_names.names[n].name = lsa_names2.names[n].name; 187 lsa_names.names[n].sid_index = lsa_names2.names[n].sid_index; 188 } 189 } 190 191 } else { 192 result = rpccli_lsa_LookupSids(cli, mem_ctx, 193 pol, 194 &sid_array, 195 &ref_domains, 196 &lsa_names, 197 level, 198 &count); 199 } 169 200 170 201 DEBUG(10, ("LSA_LOOKUPSIDS returned '%s', mapped count = %d'\n", … … 246 277 #define LOOKUP_SIDS_HUNK_SIZE 1000 247 278 248 NTSTATUS rpccli_lsa_lookup_sids(struct rpc_pipe_client *cli, 249 TALLOC_CTX *mem_ctx, 250 POLICY_HND *pol, 251 int num_sids, 252 const DOM_SID *sids, 253 char ***pdomains, 254 char ***pnames, 255 enum lsa_SidType **ptypes) 279 static NTSTATUS rpccli_lsa_lookup_sids_generic(struct rpc_pipe_client *cli, 280 TALLOC_CTX *mem_ctx, 281 struct policy_handle *pol, 282 int num_sids, 283 const DOM_SID *sids, 284 char ***pdomains, 285 char ***pnames, 286 enum lsa_SidType **ptypes, 287 bool use_lookupsids3) 256 288 { 257 289 NTSTATUS result = NT_STATUS_OK; … … 312 344 hunk_domains, 313 345 hunk_names, 314 hunk_types); 346 hunk_types, 347 use_lookupsids3); 315 348 316 349 if (!NT_STATUS_IS_OK(hunk_result) && … … 353 386 } 354 387 388 NTSTATUS rpccli_lsa_lookup_sids(struct rpc_pipe_client *cli, 389 TALLOC_CTX *mem_ctx, 390 struct policy_handle *pol, 391 int num_sids, 392 const DOM_SID *sids, 393 char ***pdomains, 394 char ***pnames, 395 enum lsa_SidType **ptypes) 396 { 397 return rpccli_lsa_lookup_sids_generic(cli, mem_ctx, pol, num_sids, sids, 398 pdomains, pnames, ptypes, false); 399 } 400 401 NTSTATUS rpccli_lsa_lookup_sids3(struct rpc_pipe_client *cli, 402 TALLOC_CTX *mem_ctx, 403 struct policy_handle *pol, 404 int num_sids, 405 const DOM_SID *sids, 406 char ***pdomains, 407 char ***pnames, 408 enum lsa_SidType **ptypes) 409 { 410 return rpccli_lsa_lookup_sids_generic(cli, mem_ctx, pol, num_sids, sids, 411 pdomains, pnames, ptypes, true); 412 } 413 355 414 /** Lookup a list of names */ 356 415 357 NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli, 358 TALLOC_CTX *mem_ctx, 359 POLICY_HND *pol, int num_names, 360 const char **names, 361 const char ***dom_names, 362 int level, 363 DOM_SID **sids, 364 enum lsa_SidType **types) 416 static NTSTATUS rpccli_lsa_lookup_names_generic(struct rpc_pipe_client *cli, 417 TALLOC_CTX *mem_ctx, 418 struct policy_handle *pol, int num_names, 419 const char **names, 420 const char ***dom_names, 421 int level, 422 DOM_SID **sids, 423 enum lsa_SidType **types, 424 bool use_lookupnames4) 365 425 { 366 426 NTSTATUS result; … … 369 429 struct lsa_RefDomainList *domains = NULL; 370 430 struct lsa_TransSidArray sid_array; 431 struct lsa_TransSidArray3 sid_array3; 371 432 uint32_t count = 0; 372 433 373 434 ZERO_STRUCT(sid_array); 435 ZERO_STRUCT(sid_array3); 374 436 375 437 lsa_names = TALLOC_ARRAY(mem_ctx, struct lsa_String, num_names); … … 382 444 } 383 445 384 result = rpccli_lsa_LookupNames(cli, mem_ctx, 385 pol, 386 num_names, 387 lsa_names, 388 &domains, 389 &sid_array, 390 level, 391 &count); 446 if (use_lookupnames4) { 447 result = rpccli_lsa_LookupNames4(cli, mem_ctx, 448 num_names, 449 lsa_names, 450 &domains, 451 &sid_array3, 452 level, 453 &count, 454 0, 455 0); 456 } else { 457 result = rpccli_lsa_LookupNames(cli, mem_ctx, 458 pol, 459 num_names, 460 lsa_names, 461 &domains, 462 &sid_array, 463 level, 464 &count); 465 } 392 466 393 467 if (!NT_STATUS_IS_OK(result) && NT_STATUS_V(result) != … … 436 510 437 511 for (i = 0; i < num_names; i++) { 438 uint32_t dom_idx = sid_array.sids[i].sid_index; 439 uint32_t dom_rid = sid_array.sids[i].rid; 512 uint32_t dom_idx; 440 513 DOM_SID *sid = &(*sids)[i]; 514 515 if (use_lookupnames4) { 516 dom_idx = sid_array3.sids[i].sid_index; 517 (*types)[i] = sid_array3.sids[i].sid_type; 518 } else { 519 dom_idx = sid_array.sids[i].sid_index; 520 (*types)[i] = sid_array.sids[i].sid_type; 521 } 441 522 442 523 /* Translate optimised sid through domain index array */ … … 449 530 } 450 531 451 sid_copy(sid, domains->domains[dom_idx].sid); 452 453 if (dom_rid != 0xffffffff) { 454 sid_append_rid(sid, dom_rid); 455 } 456 457 (*types)[i] = sid_array.sids[i].sid_type; 532 if (use_lookupnames4) { 533 sid_copy(sid, sid_array3.sids[i].sid); 534 } else { 535 sid_copy(sid, domains->domains[dom_idx].sid); 536 537 if (sid_array.sids[i].rid != 0xffffffff) { 538 sid_append_rid(sid, sid_array.sids[i].rid); 539 } 540 } 458 541 459 542 if (dom_names == NULL) { … … 468 551 return result; 469 552 } 553 554 NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli, 555 TALLOC_CTX *mem_ctx, 556 struct policy_handle *pol, int num_names, 557 const char **names, 558 const char ***dom_names, 559 int level, 560 DOM_SID **sids, 561 enum lsa_SidType **types) 562 { 563 return rpccli_lsa_lookup_names_generic(cli, mem_ctx, pol, num_names, 564 names, dom_names, level, sids, 565 types, false); 566 } 567 568 NTSTATUS rpccli_lsa_lookup_names4(struct rpc_pipe_client *cli, 569 TALLOC_CTX *mem_ctx, 570 struct policy_handle *pol, int num_names, 571 const char **names, 572 const char ***dom_names, 573 int level, 574 DOM_SID **sids, 575 enum lsa_SidType **types) 576 { 577 return rpccli_lsa_lookup_names_generic(cli, mem_ctx, pol, num_names, 578 names, dom_names, level, sids, 579 types, true); 580 } -
branches/samba-3.3.x/source/rpc_client/cli_netlogon.c
r206 r342 602 602 struct samr_Password new_password; 603 603 604 cred_hash3(new_password.hash,605 606 604 des_crypt112_16(new_password.hash, 605 new_trust_passwd_hash, 606 cli->dc->sess_key, 1); 607 607 608 608 result = rpccli_netr_ServerPasswordSet(cli, mem_ctx, -
branches/samba-3.3.x/source/rpc_client/cli_pipe.c
r206 r342 491 491 } 492 492 493 if (auth_len !=RPC_AUTH_SCHANNEL_SIGN_OR_SEAL_CHK_LEN) {493 if (auth_len < RPC_AUTH_SCHANNEL_SIGN_OR_SEAL_CHK_LEN) { 494 494 DEBUG(0,("cli_pipe_verify_schannel: auth_len %u.\n", (unsigned int)auth_len )); 495 495 return NT_STATUS_INVALID_PARAMETER; … … 2320 2320 return NT_STATUS_OK; 2321 2321 } 2322 2323 unsigned int rpccli_set_timeout(struct rpc_pipe_client *cli, 2322 unsigned int rpccli_set_timeout(struct rpc_pipe_client *rpc_cli, 2324 2323 unsigned int timeout) 2325 2324 { 2326 return cli_set_timeout(cli->trans.np.cli, timeout); 2325 struct cli_state *cli = rpc_pipe_np_smb_conn(rpc_cli); 2326 2327 if (cli == NULL) { 2328 return 0; 2329 } 2330 return cli_set_timeout(cli, timeout); 2327 2331 } 2328 2332 … … 2932 2936 2933 2937 static NTSTATUS cli_rpc_pipe_open(struct cli_state *cli, 2938 enum dcerpc_transport_t transport, 2934 2939 const struct ndr_syntax_id *interface, 2935 2940 struct rpc_pipe_client **presult) 2936 2941 { 2937 if (ndr_syntax_id_equal(interface, &ndr_table_drsuapi.syntax_id)) { 2938 /* 2939 * We should have a better way to figure out this drsuapi 2940 * speciality... 2941 */ 2942 switch (transport) { 2943 case NCACN_IP_TCP: 2942 2944 return rpc_pipe_open_tcp(NULL, cli->desthost, interface, 2943 2945 presult); 2944 } 2945 2946 return rpc_pipe_open_np(cli, interface, presult); 2946 case NCACN_NP: 2947 return rpc_pipe_open_np(cli, interface, presult); 2948 default: 2949 return NT_STATUS_NOT_IMPLEMENTED; 2950 } 2947 2951 } 2948 2952 … … 2951 2955 ****************************************************************************/ 2952 2956 2953 NTSTATUS cli_rpc_pipe_open_noauth(struct cli_state *cli, 2954 const struct ndr_syntax_id *interface, 2955 struct rpc_pipe_client **presult) 2957 NTSTATUS cli_rpc_pipe_open_noauth_transport(struct cli_state *cli, 2958 enum dcerpc_transport_t transport, 2959 const struct ndr_syntax_id *interface, 2960 struct rpc_pipe_client **presult) 2956 2961 { 2957 2962 struct rpc_pipe_client *result; … … 2959 2964 NTSTATUS status; 2960 2965 2961 status = cli_rpc_pipe_open(cli, interface, &result);2966 status = cli_rpc_pipe_open(cli, transport, interface, &result); 2962 2967 if (!NT_STATUS_IS_OK(status)) { 2963 2968 return status; … … 3016 3021 3017 3022 /**************************************************************************** 3023 ****************************************************************************/ 3024 3025 NTSTATUS cli_rpc_pipe_open_noauth(struct cli_state *cli, 3026 const struct ndr_syntax_id *interface, 3027 struct rpc_pipe_client **presult) 3028 { 3029 return cli_rpc_pipe_open_noauth_transport(cli, NCACN_NP, 3030 interface, presult); 3031 } 3032 3033 /**************************************************************************** 3018 3034 Open a named pipe to an SMB server and bind using NTLMSSP or SPNEGO NTLMSSP 3019 3035 ****************************************************************************/ … … 3021 3037 static NTSTATUS cli_rpc_pipe_open_ntlmssp_internal(struct cli_state *cli, 3022 3038 const struct ndr_syntax_id *interface, 3039 enum dcerpc_transport_t transport, 3023 3040 enum pipe_auth_type auth_type, 3024 3041 enum pipe_auth_level auth_level, … … 3032 3049 NTSTATUS status; 3033 3050 3034 status = cli_rpc_pipe_open(cli, interface, &result);3051 status = cli_rpc_pipe_open(cli, transport, interface, &result); 3035 3052 if (!NT_STATUS_IS_OK(status)) { 3036 3053 return status; … … 3074 3091 NTSTATUS cli_rpc_pipe_open_ntlmssp(struct cli_state *cli, 3075 3092 const struct ndr_syntax_id *interface, 3093 enum dcerpc_transport_t transport, 3076 3094 enum pipe_auth_level auth_level, 3077 3095 const char *domain, … … 3082 3100 return cli_rpc_pipe_open_ntlmssp_internal(cli, 3083 3101 interface, 3102 transport, 3084 3103 PIPE_AUTH_TYPE_NTLMSSP, 3085 3104 auth_level, … … 3097 3116 NTSTATUS cli_rpc_pipe_open_spnego_ntlmssp(struct cli_state *cli, 3098 3117 const struct ndr_syntax_id *interface, 3118 enum dcerpc_transport_t transport, 3099 3119 enum pipe_auth_level auth_level, 3100 3120 const char *domain, … … 3105 3125 return cli_rpc_pipe_open_ntlmssp_internal(cli, 3106 3126 interface, 3127 transport, 3107 3128 PIPE_AUTH_TYPE_SPNEGO_NTLMSSP, 3108 3129 auth_level, … … 3202 3223 NTSTATUS cli_rpc_pipe_open_schannel_with_key(struct cli_state *cli, 3203 3224 const struct ndr_syntax_id *interface, 3225 enum dcerpc_transport_t transport, 3204 3226 enum pipe_auth_level auth_level, 3205 3227 const char *domain, … … 3211 3233 NTSTATUS status; 3212 3234 3213 status = cli_rpc_pipe_open(cli, interface, &result);3235 status = cli_rpc_pipe_open(cli, transport, interface, &result); 3214 3236 if (!NT_STATUS_IS_OK(status)) { 3215 3237 return status; … … 3271 3293 3272 3294 status = cli_rpc_pipe_open_spnego_ntlmssp( 3273 cli, &ndr_table_netlogon.syntax_id, PIPE_AUTH_LEVEL_PRIVACY, 3295 cli, &ndr_table_netlogon.syntax_id, NCACN_NP, 3296 PIPE_AUTH_LEVEL_PRIVACY, 3274 3297 domain, username, password, &netlogon_pipe); 3275 3298 if (!NT_STATUS_IS_OK(status)) { … … 3296 3319 NTSTATUS cli_rpc_pipe_open_ntlmssp_auth_schannel(struct cli_state *cli, 3297 3320 const struct ndr_syntax_id *interface, 3321 enum dcerpc_transport_t transport, 3298 3322 enum pipe_auth_level auth_level, 3299 3323 const char *domain, … … 3317 3341 3318 3342 status = cli_rpc_pipe_open_schannel_with_key( 3319 cli, interface, auth_level, domain, netlogon_pipe->dc,3343 cli, interface, transport, auth_level, domain, netlogon_pipe->dc, 3320 3344 &result); 3321 3345 … … 3336 3360 NTSTATUS cli_rpc_pipe_open_schannel(struct cli_state *cli, 3337 3361 const struct ndr_syntax_id *interface, 3362 enum dcerpc_transport_t transport, 3338 3363 enum pipe_auth_level auth_level, 3339 3364 const char *domain, … … 3355 3380 3356 3381 status = cli_rpc_pipe_open_schannel_with_key( 3357 cli, interface, auth_level, domain, netlogon_pipe->dc,3382 cli, interface, transport, auth_level, domain, netlogon_pipe->dc, 3358 3383 &result); 3359 3384 … … 3387 3412 NTSTATUS status; 3388 3413 3389 status = cli_rpc_pipe_open(cli, interface, &result);3414 status = cli_rpc_pipe_open(cli, NCACN_NP, interface, &result); 3390 3415 if (!NT_STATUS_IS_OK(status)) { 3391 3416 return status; -
branches/samba-3.3.x/source/rpc_client/init_netlogon.c
r206 r342 297 297 NETLOGON_EXTRA_SIDS, 298 298 user_session_key, 299 my_name,299 talloc_strdup(sam3, my_name), 300 300 talloc_strdup(sam3, pdb_get_domain(sampw)), 301 301 sid, -
branches/samba-3.3.x/source/rpc_server/srv_netlog_nt.c
r274 r342 670 670 } 671 671 672 /* Woah - what does this to to the credential chain ? JRA */ 673 cred_hash3(pwd, r->in.new_password->hash, p->dc->sess_key, 0); 672 des_crypt112_16(pwd, r->in.new_password->hash, p->dc->sess_key, 0); 674 673 675 674 DEBUG(100,("_netr_ServerPasswordSet: new given value was :\n")); -
branches/samba-3.3.x/source/rpc_server/srv_samr_nt.c
r274 r342 262 262 *pacc_requested &= ~MAXIMUM_ALLOWED_ACCESS; 263 263 264 /* At least try for generic read . */265 *pacc_requested = GENERIC_READ_ACCESS ;264 /* At least try for generic read|execute - Everyone gets that. */ 265 *pacc_requested = GENERIC_READ_ACCESS|GENERIC_EXECUTE_ACCESS; 266 266 267 267 /* root gets anything. */ -
branches/samba-3.3.x/source/rpcclient/rpcclient.c
r206 r342 588 588 ntresult = cli_rpc_pipe_open_spnego_ntlmssp( 589 589 cli, cmd_entry->interface, 590 NCACN_NP, 590 591 pipe_default_auth_level, 591 592 lp_workgroup(), … … 597 598 ntresult = cli_rpc_pipe_open_ntlmssp( 598 599 cli, cmd_entry->interface, 600 NCACN_NP, 599 601 pipe_default_auth_level, 600 602 lp_workgroup(), … … 606 608 ntresult = cli_rpc_pipe_open_schannel( 607 609 cli, cmd_entry->interface, 610 NCACN_NP, 608 611 pipe_default_auth_level, 609 612 lp_workgroup(), -
branches/samba-3.3.x/source/smbd/files.c
r222 r342 408 408 fsp->fsp_name); 409 409 410 if (strnequal(d_fullname, d1_fullname, dlen)) { 410 /* 411 * If the open file has a path that is a longer 412 * component, then it's a subpath. 413 */ 414 if (strnequal(d_fullname, d1_fullname, dlen) && 415 (d1_fullname[dlen] == '/')) { 411 416 TALLOC_FREE(d_fullname); 412 417 TALLOC_FREE(d1_fullname); … … 414 419 } 415 420 TALLOC_FREE(d1_fullname); 416 } 421 } 417 422 418 423 TALLOC_FREE(d_fullname); -
branches/samba-3.3.x/source/smbd/notify_inotify.c
r206 r342 233 233 struct inotify_event *e0, *e; 234 234 uint32_t prev_cookie=0; 235 NTSTATUS status; 235 236 236 237 /* … … 248 249 if (e == NULL) return; 249 250 250 if (sys_read(in->fd, e0, bufsize) != bufsize) { 251 DEBUG(0,("Failed to read all inotify data\n")); 251 status = read_data(in->fd, (char *)e0, bufsize); 252 if (!NT_STATUS_IS_OK(status)) { 253 DEBUG(0,("Failed to read all inotify data - %s\n", 254 nt_errstr(status))); 252 255 talloc_free(e0); 256 /* the inotify fd will now be out of sync, 257 * can't keep reading data off it */ 258 TALLOC_FREE(fde); 253 259 return; 254 260 } -
branches/samba-3.3.x/source/smbd/posix_acls.c
r285 r342 3179 3179 SMB_ACL_T def_acl = NULL; 3180 3180 struct pai_val *pal; 3181 int ret; 3181 3182 3182 3183 *ppdesc = NULL; … … 3185 3186 3186 3187 /* Get the stat struct for the owner info. */ 3187 if(SMB_VFS_STAT(conn, name, &sbuf) != 0) { 3188 if (lp_posix_pathnames()) { 3189 ret = SMB_VFS_LSTAT(conn, name, &sbuf); 3190 } else { 3191 ret = SMB_VFS_STAT(conn, name, &sbuf); 3192 } 3193 if(ret != 0) { 3188 3194 return map_nt_error_from_unix(errno); 3189 3195 } … … 3219 3225 files_struct *fsp; 3220 3226 SMB_STRUCT_STAT st; 3227 bool posix_paths = lp_posix_pathnames(); 3221 3228 3222 3229 if(!CAN_WRITE(conn)) { … … 3226 3233 /* Case (1). */ 3227 3234 /* try the direct way first */ 3228 ret = SMB_VFS_CHOWN(conn, fname, uid, gid); 3235 if (posix_paths) { 3236 ret = SMB_VFS_LCHOWN(conn, fname, uid, gid); 3237 } else { 3238 ret = SMB_VFS_CHOWN(conn, fname, uid, gid); 3239 } 3229 3240 if (ret == 0) 3230 3241 return 0; … … 3266 3277 } 3267 3278 3268 if (SMB_VFS_STAT(conn,fname,&st)) { 3279 if (posix_paths) { 3280 ret = SMB_VFS_LSTAT(conn,fname,&st); 3281 } else { 3282 ret = SMB_VFS_STAT(conn,fname,&st); 3283 } 3284 if (ret != 0) { 3269 3285 return -1; 3270 3286 } … … 3498 3514 bool acl_set_support = false; 3499 3515 bool ret = false; 3516 bool posix_paths = lp_posix_pathnames(); 3517 int sret; 3500 3518 3501 3519 DEBUG(10,("set_nt_acl: called for file %s\n", fsp->fsp_name )); … … 3511 3529 3512 3530 if(fsp->is_directory || fsp->fh->fd == -1) { 3513 if(SMB_VFS_STAT(fsp->conn,fsp->fsp_name, &sbuf) != 0) 3531 if (posix_paths) { 3532 sret = SMB_VFS_LSTAT(fsp->conn,fsp->fsp_name, &sbuf); 3533 } else { 3534 sret = SMB_VFS_STAT(fsp->conn,fsp->fsp_name, &sbuf); 3535 } 3536 if (sret != 0) { 3514 3537 return map_nt_error_from_unix(errno); 3538 } 3515 3539 } else { 3516 3540 if(SMB_VFS_FSTAT(fsp, &sbuf) != 0) … … 3556 3580 3557 3581 if(fsp->is_directory) { 3558 if(SMB_VFS_STAT(fsp->conn, fsp->fsp_name, &sbuf) != 0) { 3582 if (posix_paths) { 3583 sret = SMB_VFS_LSTAT(fsp->conn, fsp->fsp_name, &sbuf); 3584 } else { 3585 sret = SMB_VFS_STAT(fsp->conn, fsp->fsp_name, &sbuf); 3586 } 3587 if (sret != 0) { 3559 3588 return map_nt_error_from_unix(errno); 3560 3589 } 3561 3590 } else { 3562 3563 int sret; 3564 3565 if(fsp->fh->fd == -1) 3566 sret = SMB_VFS_STAT(fsp->conn, fsp->fsp_name, &sbuf); 3567 else 3591 if(fsp->fh->fd == -1) { 3592 if (posix_paths) { 3593 sret = SMB_VFS_LSTAT(fsp->conn, fsp->fsp_name, &sbuf); 3594 } else { 3595 sret = SMB_VFS_STAT(fsp->conn, fsp->fsp_name, &sbuf); 3596 } 3597 } else { 3568 3598 sret = SMB_VFS_FSTAT(fsp, &sbuf); 3599 } 3569 3600 3570 3601 if(sret != 0) … … 3645 3676 } 3646 3677 } else { 3647 int sret = -1;3648 3649 3678 /* 3650 3679 * No default ACL - delete one if it exists. … … 3706 3735 3707 3736 if (orig_mode != posix_perms) { 3708 int sret = -1;3709 3710 3737 DEBUG(3,("set_nt_acl: chmod %s. perms = 0%o.\n", 3711 3738 fsp->fsp_name, (unsigned int)posix_perms )); -
branches/samba-3.3.x/source/smbd/reply.c
r242 r342 958 958 } 959 959 960 if (!VALID_STAT(sbuf) && (SMB_VFS_STAT(conn,name,&sbuf) != 0)) { 961 DEBUG(3,("reply_checkpath: stat of %s failed (%s)\n",name,strerror(errno))); 962 status = map_nt_error_from_unix(errno); 963 goto path_err; 960 if (!VALID_STAT(sbuf)) { 961 int ret; 962 963 if (lp_posix_pathnames()) { 964 ret = SMB_VFS_LSTAT(conn,name,&sbuf); 965 } else { 966 ret = SMB_VFS_STAT(conn,name,&sbuf); 967 } 968 if (ret != 0) { 969 DEBUG(3,("reply_checkpath: stat of %s failed (%s)\n",name,strerror(errno))); 970 status = map_nt_error_from_unix(errno); 971 goto path_err; 972 } 964 973 } 965 974 … … 1068 1077 return; 1069 1078 } 1070 if (!VALID_STAT(sbuf) && (SMB_VFS_STAT(conn,fname,&sbuf) != 0)) { 1071 DEBUG(3,("reply_getatr: stat of %s failed (%s)\n",fname,strerror(errno))); 1072 reply_unixerror(req, ERRDOS,ERRbadfile); 1073 END_PROFILE(SMBgetatr); 1074 return; 1079 if (!VALID_STAT(sbuf)) { 1080 int ret; 1081 1082 if (lp_posix_pathnames()) { 1083 ret = SMB_VFS_LSTAT(conn,fname,&sbuf); 1084 } else { 1085 ret = SMB_VFS_STAT(conn,fname,&sbuf); 1086 } 1087 if (ret != 0) { 1088 DEBUG(3,("reply_getatr: stat of %s failed (%s)\n",fname,strerror(errno))); 1089 reply_unixerror(req, ERRDOS,ERRbadfile); 1090 END_PROFILE(SMBgetatr); 1091 return; 1092 } 1075 1093 } 1076 1094 … … 2302 2320 files_struct *fsp; 2303 2321 uint32 dirtype_orig = dirtype; 2322 bool posix_paths = lp_posix_pathnames(); 2323 int ret; 2304 2324 NTSTATUS status; 2305 2325 … … 2310 2330 } 2311 2331 2312 if (SMB_VFS_LSTAT(conn,fname,&sbuf) != 0) { 2332 if (posix_paths) { 2333 ret = SMB_VFS_LSTAT(conn,fname,&sbuf); 2334 } else { 2335 ret = SMB_VFS_STAT(conn,fname,&sbuf); 2336 } 2337 if (ret != 0) { 2313 2338 return map_nt_error_from_unix(errno); 2314 2339 } … … 2396 2421 FILE_OPEN, /* create_disposition*/ 2397 2422 FILE_NON_DIRECTORY_FILE, /* create_options */ 2398 FILE_ATTRIBUTE_NORMAL, /* file_attributes */ 2423 /* file_attributes */ 2424 posix_paths ? FILE_FLAG_POSIX_SEMANTICS|0777 : 2425 FILE_ATTRIBUTE_NORMAL, 2399 2426 0, /* oplock_request */ 2400 2427 0, /* allocation_size */ -
branches/samba-3.3.x/source/utils/net.h
r224 r342 158 158 #define NET_FLAGS_SIGN 0x00000040 /* sign RPC connection */ 159 159 #define NET_FLAGS_SEAL 0x00000080 /* seal RPC connection */ 160 #define NET_FLAGS_TCP 0x00000100 /* use ncacn_ip_tcp */ 160 161 161 162 /* net share operation modes */ -
branches/samba-3.3.x/source/utils/net_join.c
r206 r342 35 35 int net_join(struct net_context *c, int argc, const char **argv) 36 36 { 37 if (argc < 1) 38 return net_join_usage(c, argc, argv); 39 40 if (StrCaseCmp(argv[0], "HELP") == 0) { 37 if ((argc > 0) && (StrCaseCmp(argv[0], "HELP") == 0)) { 41 38 net_join_usage(c, argc, argv); 42 39 return 0; -
branches/samba-3.3.x/source/utils/net_rpc.c
r309 r342 158 158 /* Always try and create an schannel netlogon pipe. */ 159 159 nt_status = cli_rpc_pipe_open_schannel( 160 cli, interface, 160 cli, interface, NCACN_NP, 161 161 PIPE_AUTH_LEVEL_PRIVACY, domain_name, 162 162 &pipe_hnd); … … 170 170 nt_status = cli_rpc_pipe_open_ntlmssp( 171 171 cli, interface, 172 (conn_flags & NET_FLAGS_TCP) ? 173 NCACN_IP_TCP : NCACN_NP, 172 174 PIPE_AUTH_LEVEL_PRIVACY, 173 175 lp_workgroup(), c->opt_user_name, … … 797 799 argv[0], 798 800 0, 799 (uint8_t **) &u0,801 (uint8_t **)(void *)&u0, 800 802 (uint32_t)-1, 801 803 &entries_read, … … 2997 2999 status = NetShareEnum(c->opt_host, 2998 3000 level, 2999 (uint8_t **) &i1,3001 (uint8_t **)(void *)&i1, 3000 3002 (uint32_t)-1, 3001 3003 &entries_read, … … 4773 4775 username, 4774 4776 3, 4775 (uint8_t **) &i3,4777 (uint8_t **)(void *)&i3, 4776 4778 preferred_len, 4777 4779 &entries_read, -
branches/samba-3.3.x/source/utils/net_rpc_join.c
r224 r342 101 101 102 102 ntret = cli_rpc_pipe_open_schannel_with_key( 103 cli, &ndr_table_netlogon.syntax_id, PIPE_AUTH_LEVEL_PRIVACY, 103 cli, &ndr_table_netlogon.syntax_id, NCACN_NP, 104 PIPE_AUTH_LEVEL_PRIVACY, 104 105 domain, netlogon_pipe->dc, &pipe_hnd); 105 106 … … 420 421 421 422 result = cli_rpc_pipe_open_schannel_with_key( 422 cli, &ndr_table_netlogon.syntax_id, 423 cli, &ndr_table_netlogon.syntax_id, NCACN_NP, 423 424 PIPE_AUTH_LEVEL_PRIVACY, domain, pipe_hnd->dc, 424 425 &netlogon_schannel_pipe); -
branches/samba-3.3.x/source/utils/net_rpc_samsync.c
r206 r342 503 503 } else { 504 504 ret = run_rpc_command(c, cli, &ndr_table_drsuapi.syntax_id, 505 NET_FLAGS_SEAL ,505 NET_FLAGS_SEAL | NET_FLAGS_TCP, 506 506 rpc_vampire_keytab_ds_internals, argc, argv); 507 507 } -
branches/samba-3.3.x/source/winbindd/winbindd.c
r274 r342 848 848 message_dispatch(winbind_messaging_context()); 849 849 850 run_events(winbind_event_context(), 0, NULL, NULL); 850 if (run_events(winbind_event_context(), 0, NULL, NULL)) { 851 return; 852 } 851 853 852 854 /* refresh the trusted domain cache */ … … 928 930 if (FD_ISSET(ev->fd, &w_fds)) 929 931 flags |= EVENT_FD_WRITE; 930 if (flags) 932 if (flags) { 931 933 ev->handler(ev, flags); 934 return; 935 } 932 936 ev = next; 933 937 } -
branches/samba-3.3.x/source/winbindd/winbindd.h
r206 r342 123 123 124 124 struct rpc_pipe_client *lsa_pipe; 125 struct rpc_pipe_client *lsa_pipe_tcp; 125 126 POLICY_HND lsa_policy; 126 127 … … 183 184 * we don't have to try _ex every time. */ 184 185 186 bool can_do_ncacn_ip_tcp; 187 185 188 /* Lookup methods for this domain (LDAP or RPC) */ 186 189 struct winbindd_methods *methods; -
branches/samba-3.3.x/source/winbindd/winbindd_ads.c
r206 r342 978 978 size_t num_members = 0; 979 979 ads_control args; 980 struct rpc_pipe_client *cli;981 POLICY_HND lsa_policy;982 980 DOM_SID *sid_mem_nocache = NULL; 983 981 char **names_nocache = NULL; … … 1124 1122 if (num_nocache > 0) { 1125 1123 1126 status = cm_connect_lsa(domain, tmp_ctx, &cli, &lsa_policy); 1127 1128 if (!NT_STATUS_IS_OK(status)) { 1129 goto done; 1130 } 1131 1132 status = rpccli_lsa_lookup_sids(cli, tmp_ctx, 1133 &lsa_policy, 1134 num_nocache, 1135 sid_mem_nocache, 1136 &domains_nocache, 1137 &names_nocache, 1138 &name_types_nocache); 1124 status = winbindd_lookup_sids(tmp_ctx, 1125 domain, 1126 num_nocache, 1127 sid_mem_nocache, 1128 &domains_nocache, 1129 &names_nocache, 1130 &name_types_nocache); 1139 1131 1140 1132 if (!(NT_STATUS_IS_OK(status) || … … 1145 1137 "- retrying...\n", nt_errstr(status))); 1146 1138 1147 status = cm_connect_lsa(domain, tmp_ctx, &cli, 1148 &lsa_policy); 1149 1150 if (!NT_STATUS_IS_OK(status)) { 1151 goto done; 1152 } 1153 1154 status = rpccli_lsa_lookup_sids(cli, tmp_ctx, 1155 &lsa_policy, 1156 num_nocache, 1157 sid_mem_nocache, 1158 &domains_nocache, 1159 &names_nocache, 1160 &name_types_nocache); 1139 status = winbindd_lookup_sids(tmp_ctx, 1140 domain, 1141 num_nocache, 1142 sid_mem_nocache, 1143 &domains_nocache, 1144 &names_nocache, 1145 &name_types_nocache); 1161 1146 } 1162 1147 -
branches/samba-3.3.x/source/winbindd/winbindd_cm.c
r223 r342 858 858 machine_password, 859 859 lp_workgroup(), 860 domain-> name);860 domain->alt_name); 861 861 862 862 if (!ADS_ERR_OK(ads_status)) { … … 1543 1543 } 1544 1544 1545 if (conn->lsa_pipe_tcp != NULL) { 1546 TALLOC_FREE(conn->lsa_pipe_tcp); 1547 /* Ok, it must be dead. Drop timeout to 0.5 sec. */ 1548 if (conn->cli) { 1549 cli_set_timeout(conn->cli, 500); 1550 } 1551 } 1552 1545 1553 if (conn->netlogon_pipe != NULL) { 1546 1554 TALLOC_FREE(conn->netlogon_pipe); … … 1917 1925 domain->name, domain->active_directory ? "" : "NOT ")); 1918 1926 1927 domain->can_do_ncacn_ip_tcp = domain->active_directory; 1928 1919 1929 TALLOC_FREE(cli); 1920 1930 … … 2039 2049 result = cli_rpc_pipe_open_spnego_ntlmssp(conn->cli, 2040 2050 &ndr_table_samr.syntax_id, 2051 NCACN_NP, 2041 2052 PIPE_AUTH_LEVEL_PRIVACY, 2042 2053 domain_name, … … 2082 2093 } 2083 2094 result = cli_rpc_pipe_open_schannel_with_key 2084 (conn->cli, &ndr_table_samr.syntax_id, PIPE_AUTH_LEVEL_PRIVACY, 2095 (conn->cli, &ndr_table_samr.syntax_id, NCACN_NP, 2096 PIPE_AUTH_LEVEL_PRIVACY, 2085 2097 domain->name, p_dcinfo, &conn->samr_pipe); 2086 2098 … … 2137 2149 done: 2138 2150 2139 if (!NT_STATUS_IS_OK(result)) { 2151 if (NT_STATUS_EQUAL(result, NT_STATUS_ACCESS_DENIED)) { 2152 /* 2153 * if we got access denied, we might just have no access rights 2154 * to talk to the remote samr server server (e.g. when we are a 2155 * PDC and we are connecting a w2k8 pdc via an interdomain 2156 * trust). In that case do not invalidate the whole connection 2157 * stack 2158 */ 2159 TALLOC_FREE(conn->samr_pipe); 2160 ZERO_STRUCT(conn->sam_domain_handle); 2161 return result; 2162 } else if (!NT_STATUS_IS_OK(result)) { 2140 2163 invalidate_cm_connection(conn); 2141 2164 return result; … … 2147 2170 SAFE_FREE(machine_account); 2148 2171 return result; 2172 } 2173 2174 /********************************************************************** 2175 open an schanneld ncacn_ip_tcp connection to LSA 2176 ***********************************************************************/ 2177 2178 NTSTATUS cm_connect_lsa_tcp(struct winbindd_domain *domain, 2179 TALLOC_CTX *mem_ctx, 2180 struct rpc_pipe_client **cli) 2181 { 2182 struct winbindd_cm_conn *conn; 2183 NTSTATUS status; 2184 2185 DEBUG(10,("cm_connect_lsa_tcp\n")); 2186 2187 status = init_dc_connection(domain); 2188 if (!NT_STATUS_IS_OK(status)) { 2189 return status; 2190 } 2191 2192 conn = &domain->conn; 2193 2194 if (conn->lsa_pipe_tcp && 2195 conn->lsa_pipe_tcp->transport_type == NCACN_IP_TCP && 2196 conn->lsa_pipe_tcp->auth->auth_level == PIPE_AUTH_LEVEL_PRIVACY) { 2197 goto done; 2198 } 2199 2200 TALLOC_FREE(conn->lsa_pipe_tcp); 2201 2202 status = cli_rpc_pipe_open_schannel(conn->cli, 2203 &ndr_table_lsarpc.syntax_id, 2204 NCACN_IP_TCP, 2205 PIPE_AUTH_LEVEL_PRIVACY, 2206 domain->name, 2207 &conn->lsa_pipe_tcp); 2208 if (!NT_STATUS_IS_OK(status)) { 2209 DEBUG(10,("cli_rpc_pipe_open_schannel failed: %s\n", 2210 nt_errstr(status))); 2211 goto done; 2212 } 2213 2214 done: 2215 if (!NT_STATUS_IS_OK(status)) { 2216 TALLOC_FREE(conn->lsa_pipe_tcp); 2217 return status; 2218 } 2219 2220 *cli = conn->lsa_pipe_tcp; 2221 2222 return status; 2149 2223 } 2150 2224 … … 2179 2253 * authenticated LSA pipe with sign & seal. */ 2180 2254 result = cli_rpc_pipe_open_spnego_ntlmssp 2181 (conn->cli, &ndr_table_lsarpc.syntax_id, 2255 (conn->cli, &ndr_table_lsarpc.syntax_id, NCACN_NP, 2182 2256 PIPE_AUTH_LEVEL_PRIVACY, 2183 2257 conn->cli->domain, conn->cli->user_name, conn_pwd, … … 2220 2294 } 2221 2295 result = cli_rpc_pipe_open_schannel_with_key 2222 (conn->cli, &ndr_table_lsarpc.syntax_id, 2296 (conn->cli, &ndr_table_lsarpc.syntax_id, NCACN_NP, 2223 2297 PIPE_AUTH_LEVEL_PRIVACY, 2224 2298 domain->name, p_dcinfo, &conn->lsa_pipe); … … 2367 2441 2368 2442 result = cli_rpc_pipe_open_schannel_with_key( 2369 conn->cli, &ndr_table_netlogon.syntax_id, 2443 conn->cli, &ndr_table_netlogon.syntax_id, NCACN_NP, 2370 2444 PIPE_AUTH_LEVEL_PRIVACY, domain->name, netlogon_pipe->dc, 2371 2445 &conn->netlogon_pipe); -
branches/samba-3.3.x/source/winbindd/winbindd_proto.h
r222 r342 74 74 /* The following definitions come from winbindd/winbindd_ads.c */ 75 75 76 /* The following definitions come from winbindd/winbindd_rpc.c */ 77 78 NTSTATUS winbindd_lookup_sids(TALLOC_CTX *mem_ctx, 79 struct winbindd_domain *domain, 80 uint32_t num_sids, 81 const struct dom_sid *sids, 82 char ***domains, 83 char ***names, 84 enum lsa_SidType **types); 85 NTSTATUS winbindd_lookup_names(TALLOC_CTX *mem_ctx, 86 struct winbindd_domain *domain, 87 uint32_t num_names, 88 const char **names, 89 const char ***domains, 90 struct dom_sid **sids, 91 enum lsa_SidType **types); 76 92 77 93 /* The following definitions come from winbindd/winbindd_async.c */ … … 218 234 NTSTATUS cm_connect_lsa(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx, 219 235 struct rpc_pipe_client **cli, POLICY_HND *lsa_policy); 236 NTSTATUS cm_connect_lsa_tcp(struct winbindd_domain *domain, 237 TALLOC_CTX *mem_ctx, 238 struct rpc_pipe_client **cli); 220 239 NTSTATUS cm_connect_netlogon(struct winbindd_domain *domain, 221 240 struct rpc_pipe_client **cli); -
branches/samba-3.3.x/source/winbindd/winbindd_rpc.c
r223 r342 278 278 enum lsa_SidType *types = NULL; 279 279 char *full_name = NULL; 280 struct rpc_pipe_client *cli;281 POLICY_HND lsa_policy;282 280 NTSTATUS name_map_status = NT_STATUS_UNSUCCESSFUL; 283 281 char *mapped_name = NULL; … … 311 309 full_name?full_name:"", domain_name )); 312 310 313 result = cm_connect_lsa(domain, mem_ctx, &cli, &lsa_policy); 314 if (!NT_STATUS_IS_OK(result)) 315 return result; 316 317 result = rpccli_lsa_lookup_names(cli, mem_ctx, &lsa_policy, 1, 318 (const char**) &full_name, NULL, 1, &sids, &types); 319 311 result = winbindd_lookup_names(mem_ctx, domain, 1, 312 (const char **)&full_name, NULL, 313 &sids, &types); 320 314 if (!NT_STATUS_IS_OK(result)) 321 315 return result; … … 343 337 enum lsa_SidType *types = NULL; 344 338 NTSTATUS result; 345 struct rpc_pipe_client *cli;346 POLICY_HND lsa_policy;347 339 NTSTATUS name_map_status = NT_STATUS_UNSUCCESSFUL; 348 340 char *mapped_name = NULL; … … 351 343 domain->name )); 352 344 353 result = cm_connect_lsa(domain, mem_ctx, &cli, &lsa_policy); 345 result = winbindd_lookup_sids(mem_ctx, 346 domain, 347 1, 348 sid, 349 &domains, 350 &names, 351 &types); 354 352 if (!NT_STATUS_IS_OK(result)) { 355 DEBUG(2,("msrpc_sid_to_name: cm_connect_lsa() failed (%s)\n",356 nt_errstr(result)));353 DEBUG(2,("msrpc_sid_to_name: failed to lookup sids: %s\n", 354 nt_errstr(result))); 357 355 return result; 358 356 } 359 357 360 361 result = rpccli_lsa_lookup_sids(cli, mem_ctx, &lsa_policy,362 1, sid, &domains, &names, &types);363 if (!NT_STATUS_IS_OK(result)) {364 DEBUG(2,("msrpc_sid_to_name: rpccli_lsa_lookup_sids() failed (%s)\n",365 nt_errstr(result)));366 return result;367 }368 358 369 359 *type = (enum lsa_SidType)types[0]; … … 396 386 char **domains; 397 387 NTSTATUS result; 398 struct rpc_pipe_client *cli;399 POLICY_HND lsa_policy;400 388 DOM_SID *sids; 401 389 size_t i; … … 419 407 } 420 408 421 result = cm_connect_lsa(domain, mem_ctx, &cli, &lsa_policy);422 if (!NT_STATUS_IS_OK(result)) {423 return result;424 }425 426 result = rpccli_lsa_lookup_sids(cli, mem_ctx, &lsa_policy,427 num_rids, sids, &domains,428 names, types); 409 result = winbindd_lookup_sids(mem_ctx, 410 domain, 411 num_rids, 412 sids, 413 &domains, 414 names, 415 types); 416 429 417 if (!NT_STATUS_IS_OK(result) && 430 418 !NT_STATUS_EQUAL(result, STATUS_SOME_UNMAPPED)) { … … 1186 1174 } 1187 1175 1176 typedef NTSTATUS (*lookup_sids_fn_t)(struct rpc_pipe_client *cli, 1177 TALLOC_CTX *mem_ctx, 1178 struct policy_handle *pol, 1179 int num_sids, 1180 const DOM_SID *sids, 1181 char ***pdomains, 1182 char ***pnames, 1183 enum lsa_SidType **ptypes); 1184 1185 NTSTATUS winbindd_lookup_sids(TALLOC_CTX *mem_ctx, 1186 struct winbindd_domain *domain, 1187 uint32_t num_sids, 1188 const struct dom_sid *sids, 1189 char ***domains, 1190 char ***names, 1191 enum lsa_SidType **types) 1192 { 1193 NTSTATUS status; 1194 struct rpc_pipe_client *cli = NULL; 1195 struct policy_handle lsa_policy; 1196 unsigned int orig_timeout; 1197 lookup_sids_fn_t lookup_sids_fn = rpccli_lsa_lookup_sids; 1198 1199 if (domain->can_do_ncacn_ip_tcp) { 1200 status = cm_connect_lsa_tcp(domain, mem_ctx, &cli); 1201 if (NT_STATUS_IS_OK(status)) { 1202 lookup_sids_fn = rpccli_lsa_lookup_sids3; 1203 goto lookup; 1204 } 1205 domain->can_do_ncacn_ip_tcp = false; 1206 } 1207 status = cm_connect_lsa(domain, mem_ctx, &cli, &lsa_policy); 1208 1209 if (!NT_STATUS_IS_OK(status)) { 1210 return status; 1211 } 1212 1213 lookup: 1214 /* 1215 * This call can take a long time 1216 * allow the server to time out. 1217 * 35 seconds should do it. 1218 */ 1219 orig_timeout = rpccli_set_timeout(cli, 35000); 1220 1221 status = lookup_sids_fn(cli, 1222 mem_ctx, 1223 &lsa_policy, 1224 num_sids, 1225 sids, 1226 domains, 1227 names, 1228 types); 1229 1230 /* And restore our original timeout. */ 1231 rpccli_set_timeout(cli, orig_timeout); 1232 1233 if (!NT_STATUS_IS_OK(status)) { 1234 return status; 1235 } 1236 1237 return status; 1238 } 1239 1240 typedef NTSTATUS (*lookup_names_fn_t)(struct rpc_pipe_client *cli, 1241 TALLOC_CTX *mem_ctx, 1242 struct policy_handle *pol, 1243 int num_names, 1244 const char **names, 1245 const char ***dom_names, 1246 int level, 1247 struct dom_sid **sids, 1248 enum lsa_SidType **types); 1249 1250 NTSTATUS winbindd_lookup_names(TALLOC_CTX *mem_ctx, 1251 struct winbindd_domain *domain, 1252 uint32_t num_names, 1253 const char **names, 1254 const char ***domains, 1255 struct dom_sid **sids, 1256 enum lsa_SidType **types) 1257 { 1258 NTSTATUS status; 1259 struct rpc_pipe_client *cli = NULL; 1260 struct policy_handle lsa_policy; 1261 unsigned int orig_timeout; 1262 lookup_names_fn_t lookup_names_fn = rpccli_lsa_lookup_names; 1263 1264 if (domain->can_do_ncacn_ip_tcp) { 1265 status = cm_connect_lsa_tcp(domain, mem_ctx, &cli); 1266 if (NT_STATUS_IS_OK(status)) { 1267 lookup_names_fn = rpccli_lsa_lookup_names4; 1268 goto lookup; 1269 } 1270 domain->can_do_ncacn_ip_tcp = false; 1271 } 1272 status = cm_connect_lsa(domain, mem_ctx, &cli, &lsa_policy); 1273 1274 if (!NT_STATUS_IS_OK(status)) { 1275 return status; 1276 } 1277 1278 lookup: 1279 1280 /* 1281 * This call can take a long time 1282 * allow the server to time out. 1283 * 35 seconds should do it. 1284 */ 1285 orig_timeout = rpccli_set_timeout(cli, 35000); 1286 1287 status = lookup_names_fn(cli, 1288 mem_ctx, 1289 &lsa_policy, 1290 num_names, 1291 (const char **) names, 1292 domains, 1293 1, 1294 sids, 1295 types); 1296 1297 /* And restore our original timeout. */ 1298 rpccli_set_timeout(cli, orig_timeout); 1299 1300 if (!NT_STATUS_IS_OK(status)) { 1301 return status; 1302 } 1303 1304 return status; 1305 } 1188 1306 1189 1307 /* the rpc backend methods are exposed via this structure */
Note:
See TracChangeset
for help on using the changeset viewer.