Changeset 745 for trunk/server/source3/lib/netapi/netapi.c
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 2 edited
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/lib/netapi/netapi.c
r414 r745 21 21 #include "lib/netapi/netapi.h" 22 22 #include "lib/netapi/netapi_private.h" 23 24 extern bool AllowDebugChange; 23 #include "secrets.h" 24 #include "krb5_env.h" 25 25 26 26 struct libnetapi_ctx *stat_ctx = NULL; … … 50 50 51 51 /**************************************************************** 52 Create a libnetapi context, for use in non-Samba applications. This 53 loads the smb.conf file and sets the debug level to 0, so that 54 applications are not flooded with debug logs at level 10, when they 55 were not expecting it. 52 56 ****************************************************************/ 53 57 54 58 NET_API_STATUS libnetapi_init(struct libnetapi_ctx **context) 55 59 { 56 NET_API_STATUS status;57 struct libnetapi_ctx *ctx = NULL;58 char *krb5_cc_env = NULL;59 60 60 if (stat_ctx && libnetapi_initialized) { 61 61 *context = stat_ctx; … … 68 68 frame = talloc_stackframe(); 69 69 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); 89 78 90 79 if (!lp_load(get_dyn_CONFIGFILE(), true, false, false, false)) { … … 94 83 } 95 84 96 AllowDebugChange = true;97 98 85 init_names(); 99 86 load_interfaces(); 100 87 reopen_logs(); 88 89 BlockSignals(True, SIGPIPE); 90 91 return libnetapi_net_init(context); 92 } 93 94 /**************************************************************** 95 Create a libnetapi context, for use inside the 'net' binary. 96 97 As we know net has already loaded the smb.conf file, and set the debug 98 level etc, this avoids doing so again (which causes trouble with -d on 99 the command line). 100 ****************************************************************/ 101 102 NET_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 } 101 115 102 116 BlockSignals(True, SIGPIPE); … … 133 147 134 148 /**************************************************************** 149 Return the static libnetapi context 135 150 ****************************************************************/ 136 151 … … 146 161 147 162 /**************************************************************** 163 Free the static libnetapi context 148 164 ****************************************************************/ 149 165 … … 182 198 183 199 /**************************************************************** 200 Override the current log level for libnetapi 184 201 ****************************************************************/ 185 202 … … 187 204 const char *debuglevel) 188 205 { 189 AllowDebugChange = true;190 206 ctx->debuglevel = talloc_strdup(ctx, debuglevel); 191 if (! debug_parse_levels(debuglevel)) {207 if (!lp_set_cmdline("log level", debuglevel)) { 192 208 return W_ERROR_V(WERR_GENERAL_FAILURE); 193 209 }
Note:
See TracChangeset
for help on using the changeset viewer.