Remove some unused code
authorVolker Lendecke <vl@samba.org>
Sun, 10 May 2009 17:17:37 +0000 (19:17 +0200)
committerVolker Lendecke <vl@samba.org>
Sun, 14 Jun 2009 09:25:47 +0000 (11:25 +0200)
source3/winbindd/winbindd.c
source3/winbindd/winbindd.h
source3/winbindd/winbindd_cache.c
source3/winbindd/winbindd_proto.h

index cb796eb7f4595277fee370115f573e6946c18e7c..31ab48f4ffe6c677cf3331734825354f7de814a3 100644 (file)
@@ -539,114 +539,6 @@ static void process_request(struct winbindd_cli_state *state)
        }
 }
 
        }
 }
 
-/*
- * A list of file descriptors being monitored by select in the main processing
- * loop. winbindd_fd_event->handler is called whenever the socket is readable/writable.
- */
-
-static struct winbindd_fd_event *fd_events = NULL;
-
-void add_fd_event(struct winbindd_fd_event *ev)
-{
-       struct winbindd_fd_event *match;
-
-       /* only add unique winbindd_fd_event structs */
-
-       for (match=fd_events; match; match=match->next ) {
-#ifdef DEVELOPER
-               SMB_ASSERT( match != ev );
-#else
-               if ( match == ev )
-                       return;
-#endif
-       }
-
-       DLIST_ADD(fd_events, ev);
-}
-
-void remove_fd_event(struct winbindd_fd_event *ev)
-{
-       DLIST_REMOVE(fd_events, ev);
-}
-
-/*
- * Handler for winbindd_fd_events to complete a read/write request, set up by
- * setup_async_read/setup_async_write.
- */
-
-static void rw_callback(struct winbindd_fd_event *event, int flags)
-{
-       size_t todo;
-       ssize_t done = 0;
-
-       todo = event->length - event->done;
-
-       if (event->flags & EVENT_FD_WRITE) {
-               SMB_ASSERT(flags == EVENT_FD_WRITE);
-               done = sys_write(event->fd,
-                                &((char *)event->data)[event->done],
-                                todo);
-
-               if (done <= 0) {
-                       event->flags = 0;
-                       event->finished(event->private_data, False);
-                       return;
-               }
-       }
-
-       if (event->flags & EVENT_FD_READ) {
-               SMB_ASSERT(flags == EVENT_FD_READ);
-               done = sys_read(event->fd, &((char *)event->data)[event->done],
-                               todo);
-
-               if (done <= 0) {
-                       event->flags = 0;
-                       event->finished(event->private_data, False);
-                       return;
-               }
-       }
-
-       event->done += done;
-
-       if (event->done == event->length) {
-               event->flags = 0;
-               event->finished(event->private_data, True);
-       }
-}
-
-/*
- * Request an async read/write on a winbindd_fd_event structure. (*finished) is called
- * when the request is completed or an error had occurred.
- */
-
-void setup_async_read(struct winbindd_fd_event *event, void *data, size_t length,
-                     void (*finished)(void *private_data, bool success),
-                     void *private_data)
-{
-       SMB_ASSERT(event->flags == 0);
-       event->data = data;
-       event->length = length;
-       event->done = 0;
-       event->handler = rw_callback;
-       event->finished = finished;
-       event->private_data = private_data;
-       event->flags = EVENT_FD_READ;
-}
-
-void setup_async_write(struct winbindd_fd_event *event, void *data, size_t length,
-                      void (*finished)(void *private_data, bool success),
-                      void *private_data)
-{
-       SMB_ASSERT(event->flags == 0);
-       event->data = data;
-       event->length = length;
-       event->done = 0;
-       event->handler = rw_callback;
-       event->finished = finished;
-       event->private_data = private_data;
-       event->flags = EVENT_FD_WRITE;
-}
-
 /*
  * This is the main event loop of winbind requests. It goes through a
  * state-machine of 3 read/write requests, 4 if you have extra data to send.
 /*
  * This is the main event loop of winbind requests. It goes through a
  * state-machine of 3 read/write requests, 4 if you have extra data to send.
@@ -962,7 +854,6 @@ failed:
 
 static void process_loop(void)
 {
 
 static void process_loop(void)
 {
-       struct winbindd_fd_event *ev;
        fd_set r_fds, w_fds;
        int maxfd = 0, selret;
        struct timeval timeout, ev_timeout;
        fd_set r_fds, w_fds;
        int maxfd = 0, selret;
        struct timeval timeout, ev_timeout;
@@ -989,17 +880,6 @@ static void process_loop(void)
                timeout = timeval_min(&timeout, &ev_timeout);
        }
 
                timeout = timeval_min(&timeout, &ev_timeout);
        }
 
-       for (ev = fd_events; ev; ev = ev->next) {
-               if (ev->flags & EVENT_FD_READ) {
-                       FD_SET(ev->fd, &r_fds);
-                       maxfd = MAX(ev->fd, maxfd);
-               }
-               if (ev->flags & EVENT_FD_WRITE) {
-                       FD_SET(ev->fd, &w_fds);
-                       maxfd = MAX(ev->fd, maxfd);
-               }
-       }
-
        /* Call select */
 
        selret = sys_select(maxfd + 1, &r_fds, &w_fds, NULL, &timeout);
        /* Call select */
 
        selret = sys_select(maxfd + 1, &r_fds, &w_fds, NULL, &timeout);
@@ -1023,19 +903,6 @@ static void process_loop(void)
 
        run_events(winbind_event_context(), selret, &r_fds, &w_fds);
 
 
        run_events(winbind_event_context(), selret, &r_fds, &w_fds);
 
-       ev = fd_events;
-       while (ev != NULL) {
-               struct winbindd_fd_event *next = ev->next;
-               int flags = 0;
-               if (FD_ISSET(ev->fd, &r_fds))
-                       flags |= EVENT_FD_READ;
-               if (FD_ISSET(ev->fd, &w_fds))
-                       flags |= EVENT_FD_WRITE;
-               if (flags)
-                       ev->handler(ev, flags);
-               ev = next;
-       }
-
        return;
 
  no_fds_ready:
        return;
 
  no_fds_ready:
index b294b6a4bda945b13f7321b5f5fcb162842cafab..7b71502999689c093fb5cbf5f3db12ff28689809 100644 (file)
 
 #define WB_REPLACE_CHAR                '_'
 
 
 #define WB_REPLACE_CHAR                '_'
 
-struct winbindd_fd_event {
-       struct winbindd_fd_event *next, *prev;
-       int fd;
-       int flags; /* see EVENT_FD_* flags */
-       void (*handler)(struct winbindd_fd_event *fde, int flags);
-       void *data;
-       size_t length, done;
-       void (*finished)(void *private_data, bool success);
-       void *private_data;
-};
-
 struct sid_ctr {
        DOM_SID *sid;
        bool finished;
 struct sid_ctr {
        DOM_SID *sid;
        bool finished;
index e5a72cbfd9365bcd05b481b885c2872d022f5f4d..3913d965caa71f84401faeb971a9867769571bfb 100644 (file)
@@ -2617,115 +2617,6 @@ void close_winbindd_cache(void)
        }
 }
 
        }
 }
 
-void cache_store_response(pid_t pid, struct winbindd_response *response)
-{
-       fstring key_str;
-
-       if (!init_wcache())
-               return;
-
-       DEBUG(10, ("Storing response for pid %d, len %d\n",
-                  (int)pid, response->length));
-
-       fstr_sprintf(key_str, "DR/%d", (int)pid);
-       if (tdb_store(wcache->tdb, string_tdb_data(key_str), 
-                     make_tdb_data((uint8 *)response, sizeof(*response)),
-                     TDB_REPLACE) == -1)
-               return;
-
-       if (response->length == sizeof(*response))
-               return;
-
-       /* There's extra data */
-
-       DEBUG(10, ("Storing extra data: len=%d\n",
-                  (int)(response->length - sizeof(*response))));
-
-       fstr_sprintf(key_str, "DE/%d", (int)pid);
-       if (tdb_store(wcache->tdb, string_tdb_data(key_str),
-                     make_tdb_data((uint8 *)response->extra_data.data,
-                                   response->length - sizeof(*response)),
-                     TDB_REPLACE) == 0)
-               return;
-
-       /* We could not store the extra data, make sure the tdb does not
-        * contain a main record with wrong dangling extra data */
-
-       fstr_sprintf(key_str, "DR/%d", (int)pid);
-       tdb_delete(wcache->tdb, string_tdb_data(key_str));
-
-       return;
-}
-
-bool cache_retrieve_response(pid_t pid, struct winbindd_response * response)
-{
-       TDB_DATA data;
-       fstring key_str;
-
-       if (!init_wcache())
-               return false;
-
-       DEBUG(10, ("Retrieving response for pid %d\n", (int)pid));
-
-       fstr_sprintf(key_str, "DR/%d", (int)pid);
-       data = tdb_fetch(wcache->tdb, string_tdb_data(key_str));
-
-       if (data.dptr == NULL)
-               return false;
-
-       if (data.dsize != sizeof(*response))
-               return false;
-
-       memcpy(response, data.dptr, data.dsize);
-       SAFE_FREE(data.dptr);
-
-       if (response->length == sizeof(*response)) {
-               response->extra_data.data = NULL;
-               return true;
-       }
-
-       /* There's extra data */
-
-       DEBUG(10, ("Retrieving extra data length=%d\n",
-                  (int)(response->length - sizeof(*response))));
-
-       fstr_sprintf(key_str, "DE/%d", (int)pid);
-       data = tdb_fetch(wcache->tdb, string_tdb_data(key_str));
-
-       if (data.dptr == NULL) {
-               DEBUG(0, ("Did not find extra data\n"));
-               return false;
-       }
-
-       if (data.dsize != (response->length - sizeof(*response))) {
-               DEBUG(0, ("Invalid extra data length: %d\n", (int)data.dsize));
-               SAFE_FREE(data.dptr);
-               return false;
-       }
-
-       dump_data(11, (uint8 *)data.dptr, data.dsize);
-
-       response->extra_data.data = data.dptr;
-       return true;
-}
-
-void cache_cleanup_response(pid_t pid)
-{
-       fstring key_str;
-
-       if (!init_wcache())
-               return;
-
-       fstr_sprintf(key_str, "DR/%d", (int)pid);
-       tdb_delete(wcache->tdb, string_tdb_data(key_str));
-
-       fstr_sprintf(key_str, "DE/%d", (int)pid);
-       tdb_delete(wcache->tdb, string_tdb_data(key_str));
-
-       return;
-}
-
-
 bool lookup_cached_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
                       char **domain_name, char **name,
                       enum lsa_SidType *type)
 bool lookup_cached_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
                       char **domain_name, char **name,
                       enum lsa_SidType *type)
index 55c0af3148c5dede0d0ac8434ea2882db7abc7f0..8380e40cb1af2ee0313d37d8a3b418e20a342bd6 100644 (file)
@@ -53,14 +53,6 @@ bool register_message_flags(bool doreg, uint32 msg_flags);
 
 struct event_context *winbind_event_context(void);
 struct messaging_context *winbind_messaging_context(void);
 
 struct event_context *winbind_event_context(void);
 struct messaging_context *winbind_messaging_context(void);
-void add_fd_event(struct winbindd_fd_event *ev);
-void remove_fd_event(struct winbindd_fd_event *ev);
-void setup_async_read(struct winbindd_fd_event *event, void *data, size_t length,
-                     void (*finished)(void *private_data, bool success),
-                     void *private_data);
-void setup_async_write(struct winbindd_fd_event *event, void *data, size_t length,
-                      void (*finished)(void *private_data, bool success),
-                      void *private_data);
 void request_error(struct winbindd_cli_state *state);
 void request_ok(struct winbindd_cli_state *state);
 bool winbindd_setup_sig_term_handler(bool parent);
 void request_error(struct winbindd_cli_state *state);
 void request_ok(struct winbindd_cli_state *state);
 bool winbindd_setup_sig_term_handler(bool parent);
@@ -157,9 +149,6 @@ bool wcache_invalidate_cache(void);
 bool init_wcache(void);
 bool initialize_winbindd_cache(void);
 void close_winbindd_cache(void);
 bool init_wcache(void);
 bool initialize_winbindd_cache(void);
 void close_winbindd_cache(void);
-void cache_store_response(pid_t pid, struct winbindd_response *response);
-bool cache_retrieve_response(pid_t pid, struct winbindd_response * response);
-void cache_cleanup_response(pid_t pid);
 bool lookup_cached_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
                       char **domain_name, char **name,
                       enum lsa_SidType *type);
 bool lookup_cached_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
                       char **domain_name, char **name,
                       enum lsa_SidType *type);