Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/source3/lib/netapi/netapi.c

    r414 r745  
    2121#include "lib/netapi/netapi.h"
    2222#include "lib/netapi/netapi_private.h"
    23 
    24 extern bool AllowDebugChange;
     23#include "secrets.h"
     24#include "krb5_env.h"
    2525
    2626struct libnetapi_ctx *stat_ctx = NULL;
     
    5050
    5151/****************************************************************
     52Create a libnetapi context, for use in non-Samba applications.  This
     53loads the smb.conf file and sets the debug level to 0, so that
     54applications are not flooded with debug logs at level 10, when they
     55were not expecting it.
    5256****************************************************************/
    5357
    5458NET_API_STATUS libnetapi_init(struct libnetapi_ctx **context)
    5559{
    56         NET_API_STATUS status;
    57         struct libnetapi_ctx *ctx = NULL;
    58         char *krb5_cc_env = NULL;
    59 
    6060        if (stat_ctx && libnetapi_initialized) {
    6161                *context = stat_ctx;
     
    6868        frame = talloc_stackframe();
    6969
    70         ctx = talloc_zero(frame, struct libnetapi_ctx);
    71         if (!ctx) {
    72                 TALLOC_FREE(frame);
    73                 return W_ERROR_V(WERR_NOMEM);
    74         }
    75 
    76         if (!DEBUGLEVEL) {
    77                 DEBUGLEVEL = 0;
    78         }
    79 
    80         /* prevent setup_logging() from closing x_stderr... */
    81         dbf = 0;
    82         setup_logging("libnetapi", true);
    83 
    84         dbf = x_stderr;
    85         x_setbuf(x_stderr, NULL);
    86         AllowDebugChange = false;
    87 
    88         load_case_tables();
     70        /* Case tables must be loaded before any string comparisons occour */
     71        load_case_tables_library();
     72
     73        /* When libnetapi is invoked from an application, it does not
     74         * want to be swamped with level 10 debug messages, even if
     75         * this has been set for the server in smb.conf */
     76        lp_set_cmdline("log level", "0");
     77        setup_logging("libnetapi", DEBUG_STDERR);
    8978
    9079        if (!lp_load(get_dyn_CONFIGFILE(), true, false, false, false)) {
     
    9483        }
    9584
    96         AllowDebugChange = true;
    97 
    9885        init_names();
    9986        load_interfaces();
    10087        reopen_logs();
     88
     89        BlockSignals(True, SIGPIPE);
     90
     91        return libnetapi_net_init(context);
     92}
     93
     94/****************************************************************
     95Create a libnetapi context, for use inside the 'net' binary.
     96
     97As we know net has already loaded the smb.conf file, and set the debug
     98level etc, this avoids doing so again (which causes trouble with -d on
     99the command line).
     100****************************************************************/
     101
     102NET_API_STATUS libnetapi_net_init(struct libnetapi_ctx **context)
     103{
     104        NET_API_STATUS status;
     105        struct libnetapi_ctx *ctx = NULL;
     106        char *krb5_cc_env = NULL;
     107
     108        frame = talloc_stackframe();
     109
     110        ctx = talloc_zero(frame, struct libnetapi_ctx);
     111        if (!ctx) {
     112                TALLOC_FREE(frame);
     113                return W_ERROR_V(WERR_NOMEM);
     114        }
    101115
    102116        BlockSignals(True, SIGPIPE);
     
    133147
    134148/****************************************************************
     149 Return the static libnetapi context
    135150****************************************************************/
    136151
     
    146161
    147162/****************************************************************
     163 Free the static libnetapi context
    148164****************************************************************/
    149165
     
    182198
    183199/****************************************************************
     200 Override the current log level for libnetapi
    184201****************************************************************/
    185202
     
    187204                                        const char *debuglevel)
    188205{
    189         AllowDebugChange = true;
    190206        ctx->debuglevel = talloc_strdup(ctx, debuglevel);
    191         if (!debug_parse_levels(debuglevel)) {
     207        if (!lp_set_cmdline("log level", debuglevel)) {
    192208                return W_ERROR_V(WERR_GENERAL_FAILURE);
    193209        }
Note: See TracChangeset for help on using the changeset viewer.