Changeset 740 for vendor/current/source3/web/swat.c
- Timestamp:
- Nov 14, 2012, 12:59:34 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/web/swat.c
r615 r740 5 5 Copyright (C) Andrew Tridgell 1997-2002 6 6 Copyright (C) John H Terpstra 2002 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/>. … … 29 29 30 30 #include "includes.h" 31 #include "system/filesys.h" 32 #include "popt_common.h" 31 33 #include "web/swat_proto.h" 34 #include "printing/pcap.h" 35 #include "printing/load.h" 36 #include "passdb.h" 37 #include "intl/lang_tdb.h" 32 38 #include "../lib/crypto/md5.h" 33 39 … … 122 128 123 129 while (*str) { 124 if (*str != ' ') *p++ = toupper_ ascii(*str);130 if (*str != ' ') *p++ = toupper_m(*str); 125 131 ++str; 126 132 } … … 169 175 170 176 snprintf(tmp, sizeof(tmp), "%02x", token[i]); 171 str ncat(token_str, tmp, sizeof(tmp));177 strlcat(token_str, tmp, sizeof(tmp)); 172 178 } 173 179 } … … 193 199 const char *token = cgi_variable_nonull(XSRF_TOKEN); 194 200 const char *time_str = cgi_variable_nonull(XSRF_TIME); 201 char *p = NULL; 202 long long xsrf_time_ll = 0; 195 203 time_t xsrf_time = 0; 196 204 time_t now = time(NULL); 197 205 198 if (sizeof(time_t) == sizeof(int)) { 199 xsrf_time = atoi(time_str); 200 } else if (sizeof(time_t) == sizeof(long)) { 201 xsrf_time = atol(time_str); 202 } else if (sizeof(time_t) == sizeof(long long)) { 203 xsrf_time = atoll(time_str); 204 } 206 errno = 0; 207 xsrf_time_ll = strtoll(time_str, &p, 10); 208 if (errno != 0) { 209 return false; 210 } 211 if (p == NULL) { 212 return false; 213 } 214 if (PTR_DIFF(p, time_str) > strlen(time_str)) { 215 return false; 216 } 217 if (xsrf_time_ll > _TYPE_MAXIMUM(time_t)) { 218 return false; 219 } 220 if (xsrf_time_ll < _TYPE_MINIMUM(time_t)) { 221 return false; 222 } 223 xsrf_time = xsrf_time_ll; 205 224 206 225 if (abs(now - xsrf_time) > XSRF_TIMEOUT) { … … 492 511 493 512 if ((parm_filter & FLAG_WIZARD) && !(parm->flags & FLAG_WIZARD)) continue; 494 513 495 514 if ((parm_filter & FLAG_ADVANCED) && !(parm->flags & FLAG_ADVANCED)) continue; 496 515 497 516 if (heading && heading != last_heading) { 498 517 printf("<tr><td></td></tr><tr><td><b><u>%s</u></b></td></tr>\n", _(heading)); … … 521 540 fprintf(f, "# from %s (%s)\n", cgi_remote_host(), cgi_remote_addr()); 522 541 fprintf(f, "# Date: %s\n\n", current_timestring(ctx, False)); 523 542 524 543 lp_dump(f, show_defaults, iNumNonAutoPrintServices); 525 544 … … 565 584 } 566 585 iNumNonAutoPrintServices = lp_numservices(); 567 pcap_cache_reload(&load_printers); 586 if (pcap_cache_loaded()) { 587 load_printers(server_event_context(), 588 server_messaging_context()); 589 } 568 590 569 591 return 1; … … 631 653 { 632 654 char *p; 633 655 634 656 if ((p = cgi_user_name()) && strcmp(p, "root")) { 635 657 printf(_("Logged in as <b>%s</b>"), p); … … 745 767 printf("<input type=reset name=\"Reset Values\" value=\"Reset\">\n"); 746 768 printf("<p>\n"); 747 769 748 770 printf("<table>\n"); 749 771 show_parameters(GLOBAL_SECTION_SNUM, 1, parm_filter, 0); … … 797 819 /* Plain text passwords are too badly broken - use encrypted passwords only */ 798 820 lp_do_parameter( GLOBAL_SECTION_SNUM, "encrypt passwords", "Yes"); 799 821 800 822 switch ( SerType ){ 801 823 case 0: … … 909 931 for(i = 0; wins_servers[i]; i++) printf("%s ", wins_servers[i]); 910 932 } 911 933 912 934 printf("\"></td></tr>\n"); 913 935 if (winstype == 3) { … … 919 941 printf("<td><input type=radio name=\"HomeExpo\" value=\"0\" %s> No</td>", (have_home == -1 ) ? "checked" : ""); 920 942 printf("<td></td></tr>\n"); 921 943 922 944 /* Enable this when we are ready .... 923 945 * printf("<tr><td><b>%s: </b></td>\n", _("Is Print Server")); … … 926 948 * printf("<td></td></tr>\n"); 927 949 */ 928 950 929 951 printf("</table></center>"); 930 952 printf("<hr>"); … … 1125 1147 return False; 1126 1148 } 1127 1149 1128 1150 if (remote_machine != NULL) { 1129 1151 ret = remote_password_change(remote_machine, user_name, … … 1139 1161 return False; 1140 1162 } 1141 1163 1142 1164 ret = local_password_change(user_name, local_flags, new_passwd, 1143 1165 &err_str, &msg_str); … … 1222 1244 local_flags |= (cgi_variable(ENABLE_USER_FLAG) ? LOCAL_ENABLE_USER : 0); 1223 1245 local_flags |= (cgi_variable(DISABLE_USER_FLAG) ? LOCAL_DISABLE_USER : 0); 1224 1225 1246 1226 1247 rslt = change_password(host, … … 1237 1258 } 1238 1259 } 1239 1260 1240 1261 return; 1241 1262 } … … 1527 1548 BlockSignals(True,SIGPIPE); 1528 1549 1529 dbf = x_fopen("/dev/null", O_WRONLY, 0); 1530 if (!dbf) dbf = x_stderr; 1550 debug_set_logfile("/dev/null"); 1531 1551 1532 1552 /* we don't want stderr screwing us up */ 1533 1553 close(2); 1534 1554 open("/dev/null", O_WRONLY); 1535 1555 setup_logging("swat", DEBUG_FILE); 1556 1557 load_case_tables(); 1558 1536 1559 pc = poptGetContext("swat", argc, (const char **) argv, long_options, 0); 1537 1560 … … 1542 1565 poptFreeContext(pc); 1543 1566 1544 load_case_tables(); 1545 1546 setup_logging(argv[0],False); 1567 /* This should set a more apporiate log file */ 1547 1568 load_config(True); 1569 reopen_logs(); 1548 1570 load_interfaces(); 1549 1571 iNumNonAutoPrintServices = lp_numservices(); 1550 pcap_cache_reload(&load_printers); 1572 if (pcap_cache_loaded()) { 1573 load_printers(server_event_context(), 1574 server_messaging_context()); 1575 } 1551 1576 1552 1577 cgi_setup(get_dyn_SWATDIR(), !demo_mode);
Note:
See TracChangeset
for help on using the changeset viewer.