Revert "smbd: add smbd_impersonate_debug_create() helper"
authorRalph Boehme <slow@samba.org>
Thu, 27 Dec 2018 10:41:57 +0000 (11:41 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 11 Jan 2019 22:11:15 +0000 (23:11 +0100)
This reverts commit 23319ef5a2eff4811b685d4ab54179efc49bac99.

See the discussion in

https://lists.samba.org/archive/samba-technical/2018-December/131731.html

for the reasoning behind this revert.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/smbd/proto.h
source3/smbd/uid.c

index 8d088785164363019ad7ef43f3625b88a412f919..ba9ab501adbf4911367e918d5e842540e832957d 100644 (file)
@@ -1211,12 +1211,6 @@ void reply_transs2(struct smb_request *req);
 
 /* The following definitions come from smbd/uid.c  */
 
-#define smbd_impersonate_debug_create(main_ev, name, dbg_lvl) \
-       _smbd_impersonate_debug_create(main_ev, name, dbg_lvl, __location__)
-struct tevent_context *_smbd_impersonate_debug_create(struct tevent_context *main_ev,
-                                                     const char *name,
-                                                     int dbg_lvl,
-                                                     const char *location);
 bool change_to_guest(void);
 NTSTATUS check_user_share_access(connection_struct *conn,
                                const struct auth_session_info *session_info,
index c850708bbe8e0f7c2186a310c9820e6a5797c4f7..adf9e8c1c51abd304e5ffe83453fdd349d075656 100644 (file)
 #include "passdb/lookup_sid.h"
 #include "auth.h"
 #include "../auth/auth_util.h"
-#include "lib/util/time_basic.h"
-
-struct smbd_impersonate_debug_state {
-       int dbg_lvl;
-       const char *name;
-};
-
-static bool smbd_impersonate_debug_before_use(struct tevent_context *wrap_ev,
-                                             void *private_data,
-                                             struct tevent_context *main_ev,
-                                             const char *location)
-{
-       struct smbd_impersonate_debug_state *state =
-               (struct smbd_impersonate_debug_state *)private_data;
-
-       DEBUG(state->dbg_lvl, (
-             "%s: name[%s] wrap_ev[%p] state[%p] main_ev[%p] location[%s]\n",
-             __func__, state->name, wrap_ev, state, main_ev, location));
-
-       return true;
-}
-
-static void smbd_impersonate_debug_after_use(struct tevent_context *wrap_ev,
-                                            void *private_data,
-                                            struct tevent_context *main_ev,
-                                            const char *location)
-{
-       struct smbd_impersonate_debug_state *state =
-               (struct smbd_impersonate_debug_state *)private_data;
-
-       DEBUG(state->dbg_lvl, (
-             "%s: name[%s] wrap_ev[%p] state[%p] main_ev[%p] location[%s]\n",
-             __func__, state->name, wrap_ev, state, main_ev, location));
-}
-
-static void smbd_impersonate_debug_before_fd_handler(struct tevent_context *wrap_ev,
-                                               void *private_data,
-                                               struct tevent_context *main_ev,
-                                               struct tevent_fd *fde,
-                                               uint16_t flags,
-                                               const char *handler_name,
-                                               const char *location)
-{
-       struct smbd_impersonate_debug_state *state =
-               (struct smbd_impersonate_debug_state *)private_data;
-
-       DEBUG(state->dbg_lvl, (
-             "%s: name[%s] wrap_ev[%p] state[%p] main_ev[%p] "
-             "fde[%p] flags[0x%X] handler_name[%s] location[%s]\n",
-             __func__, state->name, wrap_ev, state, main_ev,
-             fde, flags, handler_name, location));
-}
-
-static void smbd_impersonate_debug_after_fd_handler(struct tevent_context *wrap_ev,
-                                               void *private_data,
-                                               struct tevent_context *main_ev,
-                                               struct tevent_fd *fde,
-                                               uint16_t flags,
-                                               const char *handler_name,
-                                               const char *location)
-{
-       struct smbd_impersonate_debug_state *state =
-               (struct smbd_impersonate_debug_state *)private_data;
-
-       DEBUG(state->dbg_lvl, (
-             "%s: name[%s] wrap_ev[%p] state[%p] main_ev[%p] "
-             "fde[%p] flags[0x%X] handler_name[%s] location[%s]\n",
-             __func__, state->name, wrap_ev, state, main_ev,
-             fde, flags, handler_name, location));
-}
-
-static void smbd_impersonate_debug_before_timer_handler(struct tevent_context *wrap_ev,
-                                               void *private_data,
-                                               struct tevent_context *main_ev,
-                                               struct tevent_timer *te,
-                                               struct timeval requested_time,
-                                               struct timeval trigger_time,
-                                               const char *handler_name,
-                                               const char *location)
-{
-       struct smbd_impersonate_debug_state *state =
-               (struct smbd_impersonate_debug_state *)private_data;
-       struct timeval_buf requested_buf;
-       struct timeval_buf trigger_buf;
-
-       DEBUG(state->dbg_lvl, (
-             "%s: name[%s] wrap_ev[%p] state[%p] main_ev[%p] "
-             "te[%p] requested_time[%s] trigger_time[%s] handler_name[%s] location[%s]\n",
-             __func__, state->name, wrap_ev, state, main_ev, te,
-             timeval_str_buf(&requested_time, true, true, &requested_buf),
-             timeval_str_buf(&trigger_time, true, true, &trigger_buf),
-             handler_name, location));
-}
-
-static void smbd_impersonate_debug_after_timer_handler(struct tevent_context *wrap_ev,
-                                               void *private_data,
-                                               struct tevent_context *main_ev,
-                                               struct tevent_timer *te,
-                                               struct timeval requested_time,
-                                               struct timeval trigger_time,
-                                               const char *handler_name,
-                                               const char *location)
-{
-       struct smbd_impersonate_debug_state *state =
-               (struct smbd_impersonate_debug_state *)private_data;
-       struct timeval_buf requested_buf;
-       struct timeval_buf trigger_buf;
-
-       DEBUG(state->dbg_lvl, (
-             "%s: name[%s] wrap_ev[%p] state[%p] main_ev[%p] "
-             "te[%p] requested_time[%s] trigger_time[%s] handler_name[%s] location[%s]\n",
-             __func__, state->name, wrap_ev, state, main_ev, te,
-             timeval_str_buf(&requested_time, true, true, &requested_buf),
-             timeval_str_buf(&trigger_time, true, true, &trigger_buf),
-             handler_name, location));
-}
-
-static void smbd_impersonate_debug_before_immediate_handler(struct tevent_context *wrap_ev,
-                                               void *private_data,
-                                               struct tevent_context *main_ev,
-                                               struct tevent_immediate *im,
-                                               const char *handler_name,
-                                               const char *location)
-{
-       struct smbd_impersonate_debug_state *state =
-               (struct smbd_impersonate_debug_state *)private_data;
-
-       DEBUG(state->dbg_lvl, (
-             "%s: name[%s] wrap_ev[%p] state[%p] main_ev[%p] "
-             "im[%p] handler_name[%s] location[%s]\n",
-             __func__, state->name, wrap_ev, state, main_ev,
-             im, handler_name, location));
-}
-
-static void smbd_impersonate_debug_after_immediate_handler(struct tevent_context *wrap_ev,
-                                               void *private_data,
-                                               struct tevent_context *main_ev,
-                                               struct tevent_immediate *im,
-                                               const char *handler_name,
-                                               const char *location)
-{
-       struct smbd_impersonate_debug_state *state =
-               (struct smbd_impersonate_debug_state *)private_data;
-
-       DEBUG(state->dbg_lvl, (
-             "%s: name[%s] wrap_ev[%p] state[%p] main_ev[%p] "
-             "im[%p] handler_name[%s] location[%s]\n",
-             __func__, state->name, wrap_ev, state, main_ev,
-             im, handler_name, location));
-}
-
-static void smbd_impersonate_debug_before_signal_handler(struct tevent_context *wrap_ev,
-                                               void *private_data,
-                                               struct tevent_context *main_ev,
-                                               struct tevent_signal *se,
-                                               int signum,
-                                               int count,
-                                               void *siginfo,
-                                               const char *handler_name,
-                                               const char *location)
-{
-       struct smbd_impersonate_debug_state *state =
-               (struct smbd_impersonate_debug_state *)private_data;
-
-       DEBUG(state->dbg_lvl, (
-             "%s: name[%s] wrap_ev[%p] state[%p] main_ev[%p] "
-             "se[%p] signum[%d] count[%d] siginfo[%p] handler_name[%s] location[%s]\n",
-             __func__, state->name, wrap_ev, state, main_ev,
-             se, signum, count, siginfo, handler_name, location));
-}
-
-static void smbd_impersonate_debug_after_signal_handler(struct tevent_context *wrap_ev,
-                                               void *private_data,
-                                               struct tevent_context *main_ev,
-                                               struct tevent_signal *se,
-                                               int signum,
-                                               int count,
-                                               void *siginfo,
-                                               const char *handler_name,
-                                               const char *location)
-{
-       struct smbd_impersonate_debug_state *state =
-               (struct smbd_impersonate_debug_state *)private_data;
-
-       DEBUG(state->dbg_lvl, (
-             "%s: name[%s] wrap_ev[%p] state[%p] main_ev[%p] "
-             "se[%p] signum[%d] count[%d] siginfo[%p] handler_name[%s] location[%s]\n",
-             __func__, state->name, wrap_ev, state, main_ev,
-             se, signum, count, siginfo, handler_name, location));
-}
-
-static const struct tevent_wrapper_ops smbd_impersonate_debug_ops = {
-       .name                           = "smbd_impersonate_debug",
-       .before_use                     = smbd_impersonate_debug_before_use,
-       .after_use                      = smbd_impersonate_debug_after_use,
-       .before_fd_handler              = smbd_impersonate_debug_before_fd_handler,
-       .after_fd_handler               = smbd_impersonate_debug_after_fd_handler,
-       .before_timer_handler           = smbd_impersonate_debug_before_timer_handler,
-       .after_timer_handler            = smbd_impersonate_debug_after_timer_handler,
-       .before_immediate_handler       = smbd_impersonate_debug_before_immediate_handler,
-       .after_immediate_handler        = smbd_impersonate_debug_after_immediate_handler,
-       .before_signal_handler          = smbd_impersonate_debug_before_signal_handler,
-       .after_signal_handler           = smbd_impersonate_debug_after_signal_handler,
-};
-
-struct tevent_context *_smbd_impersonate_debug_create(struct tevent_context *main_ev,
-                                                     const char *name,
-                                                     int dbg_lvl,
-                                                     const char *location)
-{
-       struct tevent_context *wrap_ev = NULL;
-       struct smbd_impersonate_debug_state *state = NULL;
-
-       wrap_ev = tevent_context_wrapper_create(main_ev,
-                                       main_ev,
-                                       &smbd_impersonate_debug_ops,
-                                       &state,
-                                       struct smbd_impersonate_debug_state);
-       if (wrap_ev == NULL) {
-               return NULL;
-       }
-       state->name = name;
-       state->dbg_lvl = dbg_lvl;
-       DEBUG(state->dbg_lvl, (
-             "%s: name[%s] wrap_ev[%p] state[%p] main_ev[%p] location[%s]\n",
-             __func__, state->name, wrap_ev, state, main_ev, location));
-
-       return wrap_ev;
-}
 
 /* what user is current? */
 extern struct current_user current_user;