summaryrefslogtreecommitdiff
path: root/source4/smbd/process_standard.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-12-13 10:58:48 +0000
committerAndrew Tridgell <tridge@samba.org>2003-12-13 10:58:48 +0000
commitd4705378ce88d1bb2f787338c531998d37d078ef (patch)
tree5c69c190347bd71067203aa89f0e99db4bc50a38 /source4/smbd/process_standard.c
parent8faa77f177833eeee245391840d06771f46e0136 (diff)
downloadsamba-d4705378ce88d1bb2f787338c531998d37d078ef.tar.gz
samba-d4705378ce88d1bb2f787338c531998d37d078ef.tar.bz2
samba-d4705378ce88d1bb2f787338c531998d37d078ef.zip
dcerpc over tcp in the samba4 server now works to some extent. It
needs quite a bit more work to get it finished. The biggest missing feature is the lack of NTLMSSP which is needed for basic authentication over tcp (This used to be commit 9fb0f0369356909c99389e2cbc525be27c08793c)
Diffstat (limited to 'source4/smbd/process_standard.c')
-rw-r--r--source4/smbd/process_standard.c41
1 files changed, 39 insertions, 2 deletions
diff --git a/source4/smbd/process_standard.c b/source4/smbd/process_standard.c
index f12784bc79..507c179a26 100644
--- a/source4/smbd/process_standard.c
+++ b/source4/smbd/process_standard.c
@@ -59,7 +59,8 @@ static void accept_connection(struct event_context *ev, struct fd_event *fde, ti
/* Child code ... */
/* close all the listening sockets */
- event_remove_fd_all_handler(ev, accept_connection);
+ event_remove_fd_all_handler(ev, model_ops->accept_connection);
+ event_remove_fd_all_handler(ev, model_ops->accept_rpc_connection);
/* tdb needs special fork handling */
if (tdb_reopen_all() == -1) {
@@ -72,11 +73,46 @@ static void accept_connection(struct event_context *ev, struct fd_event *fde, ti
/* initialize new process */
smbd_process_init();
- init_smbsession(ev, model_ops, accepted_fd);
+ init_smbsession(ev, model_ops, accepted_fd, smbd_read_handler);
/* return to the event loop */
}
+/*
+ called when a rpc listening socket becomes readable
+*/
+static void accept_rpc_connection(struct event_context *ev, struct fd_event *fde, time_t t, uint16 flags)
+{
+ int accepted_fd;
+ struct sockaddr addr;
+ socklen_t in_addrlen = sizeof(addr);
+ pid_t pid;
+
+ accepted_fd = accept(fde->fd,&addr,&in_addrlen);
+ if (accepted_fd == -1) {
+ DEBUG(0,("accept_connection_standard: accept: %s\n",
+ strerror(errno)));
+ return;
+ }
+
+ pid = fork();
+
+ if (pid != 0) {
+ /* parent or error code ... */
+ close(accepted_fd);
+ /* go back to the event loop */
+ return;
+ }
+
+ /* Child code ... */
+
+ /* close all the listening sockets */
+ event_remove_fd_all_handler(ev, accept_connection);
+ event_remove_fd_all_handler(ev, accept_rpc_connection);
+
+ init_rpc_session(ev, fde->private, accepted_fd);
+}
+
/* called when a SMB connection goes down */
static void terminate_connection(struct server_context *server, const char *reason)
{
@@ -102,6 +138,7 @@ void process_model_standard_init(void)
/* fill in all the operations */
ops.model_startup = model_startup;
ops.accept_connection = accept_connection;
+ ops.accept_rpc_connection = accept_rpc_connection;
ops.terminate_connection = terminate_connection;
ops.get_id = get_id;