summaryrefslogtreecommitdiff
path: root/source3/winbindd
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-05-10 19:17:37 +0200
committerVolker Lendecke <vl@samba.org>2009-06-14 11:25:47 +0200
commit0834574fdd6b469797b3b6a4edd45f321b9b9971 (patch)
tree78b9c5231192f868a076838a42fd2b820ae5e77d /source3/winbindd
parent9b06c27cdb5f896cfd92eb103132cee258b87ca1 (diff)
downloadsamba-0834574fdd6b469797b3b6a4edd45f321b9b9971.tar.gz
samba-0834574fdd6b469797b3b6a4edd45f321b9b9971.tar.bz2
samba-0834574fdd6b469797b3b6a4edd45f321b9b9971.zip
Remove some unused code
Diffstat (limited to 'source3/winbindd')
-rw-r--r--source3/winbindd/winbindd.c133
-rw-r--r--source3/winbindd/winbindd.h11
-rw-r--r--source3/winbindd/winbindd_cache.c109
-rw-r--r--source3/winbindd/winbindd_proto.h11
4 files changed, 0 insertions, 264 deletions
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index cb796eb7f4..31ab48f4ff 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -540,114 +540,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.
*
@@ -962,7 +854,6 @@ failed:
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;
@@ -989,17 +880,6 @@ static void process_loop(void)
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);
@@ -1023,19 +903,6 @@ static void process_loop(void)
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:
diff --git a/source3/winbindd/winbindd.h b/source3/winbindd/winbindd.h
index b294b6a4bd..7b71502999 100644
--- a/source3/winbindd/winbindd.h
+++ b/source3/winbindd/winbindd.h
@@ -39,17 +39,6 @@
#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;
diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c
index e5a72cbfd9..3913d965ca 100644
--- a/source3/winbindd/winbindd_cache.c
+++ b/source3/winbindd/winbindd_cache.c
@@ -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)
diff --git a/source3/winbindd/winbindd_proto.h b/source3/winbindd/winbindd_proto.h
index 55c0af3148..8380e40cb1 100644
--- a/source3/winbindd/winbindd_proto.h
+++ b/source3/winbindd/winbindd_proto.h
@@ -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);
-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);
@@ -157,9 +149,6 @@ bool wcache_invalidate_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);