Ignore:
Timestamp:
Nov 14, 2012, 12:59:34 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to 3.6.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/web/swat.c

    r615 r740  
    55   Copyright (C) Andrew Tridgell 1997-2002
    66   Copyright (C) John H Terpstra 2002
    7    
     7
    88   This program is free software; you can redistribute it and/or modify
    99   it under the terms of the GNU General Public License as published by
    1010   the Free Software Foundation; either version 3 of the License, or
    1111   (at your option) any later version.
    12    
     12
    1313   This program is distributed in the hope that it will be useful,
    1414   but WITHOUT ANY WARRANTY; without even the implied warranty of
    1515   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1616   GNU General Public License for more details.
    17    
     17
    1818   You should have received a copy of the GNU General Public License
    1919   along with this program.  If not, see <http://www.gnu.org/licenses/>.
     
    2929
    3030#include "includes.h"
     31#include "system/filesys.h"
     32#include "popt_common.h"
    3133#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"
    3238#include "../lib/crypto/md5.h"
    3339
     
    122128
    123129        while (*str) {
    124                 if (*str != ' ') *p++ = toupper_ascii(*str);
     130                if (*str != ' ') *p++ = toupper_m(*str);
    125131                ++str;
    126132        }
     
    169175
    170176                snprintf(tmp, sizeof(tmp), "%02x", token[i]);
    171                 strncat(token_str, tmp, sizeof(tmp));
     177                strlcat(token_str, tmp, sizeof(tmp));
    172178        }
    173179}
     
    193199        const char *token = cgi_variable_nonull(XSRF_TOKEN);
    194200        const char *time_str = cgi_variable_nonull(XSRF_TIME);
     201        char *p = NULL;
     202        long long xsrf_time_ll = 0;
    195203        time_t xsrf_time = 0;
    196204        time_t now = time(NULL);
    197205
    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;
    205224
    206225        if (abs(now - xsrf_time) > XSRF_TIMEOUT) {
     
    492511
    493512                if ((parm_filter & FLAG_WIZARD) && !(parm->flags & FLAG_WIZARD)) continue;
    494                
     513
    495514                if ((parm_filter & FLAG_ADVANCED) && !(parm->flags & FLAG_ADVANCED)) continue;
    496                
     515
    497516                if (heading && heading != last_heading) {
    498517                        printf("<tr><td></td></tr><tr><td><b><u>%s</u></b></td></tr>\n", _(heading));
     
    521540        fprintf(f, "# from %s (%s)\n", cgi_remote_host(), cgi_remote_addr());
    522541        fprintf(f, "# Date: %s\n\n", current_timestring(ctx, False));
    523        
     542
    524543        lp_dump(f, show_defaults, iNumNonAutoPrintServices);
    525544
     
    565584        }
    566585        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        }
    568590
    569591        return 1;
     
    631653{
    632654        char *p;
    633        
     655
    634656        if ((p = cgi_user_name()) && strcmp(p, "root")) {
    635657                printf(_("Logged in as <b>%s</b>"), p);
     
    745767        printf("<input type=reset name=\"Reset Values\" value=\"Reset\">\n");
    746768        printf("<p>\n");
    747        
     769
    748770        printf("<table>\n");
    749771        show_parameters(GLOBAL_SECTION_SNUM, 1, parm_filter, 0);
     
    797819                /* Plain text passwords are too badly broken - use encrypted passwords only */
    798820                lp_do_parameter( GLOBAL_SECTION_SNUM, "encrypt passwords", "Yes");
    799                
     821
    800822                switch ( SerType ){
    801823                        case 0:
     
    909931                for(i = 0; wins_servers[i]; i++) printf("%s ", wins_servers[i]);
    910932        }
    911        
     933
    912934        printf("\"></td></tr>\n");
    913935        if (winstype == 3) {
     
    919941        printf("<td><input type=radio name=\"HomeExpo\" value=\"0\" %s> No</td>", (have_home == -1 ) ? "checked" : "");
    920942        printf("<td></td></tr>\n");
    921        
     943
    922944        /* Enable this when we are ready ....
    923945         * printf("<tr><td><b>%s:&nbsp;</b></td>\n", _("Is Print Server"));
     
    926948         * printf("<td></td></tr>\n");
    927949         */
    928        
     950
    929951        printf("</table></center>");
    930952        printf("<hr>");
     
    11251147                return False;
    11261148        }
    1127        
     1149
    11281150        if (remote_machine != NULL) {
    11291151                ret = remote_password_change(remote_machine, user_name,
     
    11391161                return False;
    11401162        }
    1141        
     1163
    11421164        ret = local_password_change(user_name, local_flags, new_passwd,
    11431165                                        &err_str, &msg_str);
     
    12221244        local_flags |= (cgi_variable(ENABLE_USER_FLAG) ? LOCAL_ENABLE_USER : 0);
    12231245        local_flags |= (cgi_variable(DISABLE_USER_FLAG) ? LOCAL_DISABLE_USER : 0);
    1224        
    12251246
    12261247        rslt = change_password(host,
     
    12371258                }
    12381259        }
    1239        
     1260
    12401261        return;
    12411262}
     
    15271548        BlockSignals(True,SIGPIPE);
    15281549
    1529         dbf = x_fopen("/dev/null", O_WRONLY, 0);
    1530         if (!dbf) dbf = x_stderr;
     1550        debug_set_logfile("/dev/null");
    15311551
    15321552        /* we don't want stderr screwing us up */
    15331553        close(2);
    15341554        open("/dev/null", O_WRONLY);
    1535 
     1555        setup_logging("swat", DEBUG_FILE);
     1556
     1557        load_case_tables();
     1558       
    15361559        pc = poptGetContext("swat", argc, (const char **) argv, long_options, 0);
    15371560
     
    15421565        poptFreeContext(pc);
    15431566
    1544         load_case_tables();
    1545 
    1546         setup_logging(argv[0],False);
     1567        /* This should set a more apporiate log file */
    15471568        load_config(True);
     1569        reopen_logs();
    15481570        load_interfaces();
    15491571        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        }
    15511576
    15521577        cgi_setup(get_dyn_SWATDIR(), !demo_mode);
Note: See TracChangeset for help on using the changeset viewer.