Changeset 745 for trunk/server/source3/web/cgi.c
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
source3/web/cgi.c (modified) (15 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/source3/web/cgi.c
r617 r745 2 2 some simple CGI helper routines 3 3 Copyright (C) Andrew Tridgell 1997-1998 4 4 5 5 This program is free software; you can redistribute it and/or modify 6 6 it under the terms of the GNU General Public License as published by 7 7 the Free Software Foundation; either version 3 of the License, or 8 8 (at your option) any later version. 9 9 10 10 This program is distributed in the hope that it will be useful, 11 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 13 GNU General Public License for more details. 14 14 15 15 You should have received a copy of the GNU General Public License 16 16 along with this program. If not, see <http://www.gnu.org/licenses/>. … … 19 19 20 20 #include "includes.h" 21 22 21 23 #include "web/swat_proto.h" 24 25 22 26 #include "secrets.h" 23 #include "../lib/util/util.h"24 27 25 28 #define MAX_VARIABLES 10000 … … 57 60 while ((*cl)) { 58 61 int c; 59 62 60 63 if (i == len) { 61 64 char *ret2; … … 66 69 ret = ret2; 67 70 } 68 71 69 72 c = fgetc(f); 70 73 (*cl)--; … … 74 77 break; 75 78 } 76 79 77 80 if (c == '\r') continue; 78 81 … … 82 85 83 86 } 84 87 85 88 if (ret) { 86 89 ret[i] = 0; … … 136 139 p = strchr_m(line,'='); 137 140 if (!p) continue; 138 141 139 142 *p = 0; 140 143 141 144 variables[num_variables].name = SMB_STRDUP(line); 142 145 variables[num_variables].value = SMB_STRDUP(p+1); 143 146 144 147 SAFE_FREE(line); 145 148 146 149 if (!variables[num_variables].name || 147 150 !variables[num_variables].value) … … 158 161 variables[num_variables].value); 159 162 #endif 160 163 161 164 num_variables++; 162 165 if (num_variables == MAX_VARIABLES) break; … … 173 176 p = strchr_m(tok,'='); 174 177 if (!p) continue; 175 178 176 179 *p = 0; 177 180 178 181 variables[num_variables].name = SMB_STRDUP(tok); 179 182 variables[num_variables].value = SMB_STRDUP(p+1); … … 319 322 320 323 #ifndef __OS2__ 321 pwd = Get_Pwnam_alloc(talloc_autofree_context(), user); 322 324 pwd = Get_Pwnam_alloc(talloc_tos(), user); 323 325 if (!pwd) { 324 326 printf("%sCannot find user %s<br>%s\n", head, user, tail); … … 332 334 if (C_pass == NULL) { 333 335 char *tmp_pass = NULL; 334 tmp_pass = generate_random_str(talloc_tos(), 16); 336 tmp_pass = generate_random_password(talloc_tos(), 337 16, 16); 335 338 if (tmp_pass == NULL) { 336 339 printf("%sFailed to create random nonce for " … … 362 365 fstring user, user_pass; 363 366 struct passwd *pass = NULL; 367 368 364 369 365 370 if (!strnequal(line,"Basic ", 6)) { … … 389 394 * Try and get the user from the UNIX password file. 390 395 */ 391 392 pass = Get_Pwnam_alloc(talloc_autofree_context(), user); 393 396 397 pass = Get_Pwnam_alloc(talloc_tos(), user); 398 399 rhost = client_name(1); 400 if (strequal(rhost,"UNKNOWN")) 401 rhost = client_addr(1, addr, sizeof(addr)); 402 394 403 /* 395 404 * Validate the password they have given. 396 405 */ 397 398 if NT_STATUS_IS_OK(pass_check(pass, user, user_pass, 399 strlen(user_pass), NULL, False)) { 400 406 407 if NT_STATUS_IS_OK(pass_check(pass, user, rhost, user_pass, false)) { 401 408 if (pass) { 402 409 /* 403 410 * Password was ok. 404 411 */ 405 412 406 413 if ( initgroups(pass->pw_name, pass->pw_gid) != 0 ) 407 414 goto err; 408 415 409 416 become_user_permanently(pass->pw_uid, pass->pw_gid); 410 417 411 418 /* Save the users name */ 412 419 C_user = SMB_STRDUP(user); … … 416 423 } 417 424 } 418 425 419 426 err: 420 427 cgi_setup_error("401 Bad Authorization", … … 539 546 540 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 541 629 542 630 /**
Note:
See TracChangeset
for help on using the changeset viewer.
