Return the same privilaged winbindd socket as we actually use.
[kai/samba.git] / source4 / winbind / wb_server.h
index e90ea7f0a72441d0b8c43e93c976afaa539258aa..97d7d8151e35db25c1576dbf81f66ba9469c2815 100644 (file)
@@ -7,7 +7,7 @@
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#define WINBINDD_DIR "/tmp/.winbindd/"
-#define WINBINDD_SOCKET WINBINDD_DIR"socket"
-/* the privileged socket is in smbd_tmp_dir() */
-#define WINBINDD_PRIVILEGED_SOCKET "winbind_socket"
+#include "nsswitch/winbind_nss_config.h"
+#include "nsswitch/winbind_struct_protocol.h"
+#include "winbind/idmap.h"
+#include "libnet/libnet.h"
 
-#define WINBINDD_SAMBA3_SOCKET WINBINDD_DIR"pipe"
+#define WINBINDD_SAMBA3_SOCKET "pipe"
 /* the privileged socket is in smbd_tmp_dir() */
 #define WINBINDD_SAMBA3_PRIVILEGED_SOCKET "winbind_pipe"
 
 /* this struct stores global data for the winbind task */
 struct wbsrv_service {
        struct task_server *task;
-       struct dcerpc_pipe *netlogon;
-       struct dcerpc_pipe *lsa_pipe;
+
+       const struct dom_sid *primary_sid;
+       struct wbsrv_domain *domains;
+       struct idmap_context *idmap_ctx;
+
+       const char *priv_socket_path;
 };
 
-/* 
-  this is an abstraction for the actual protocol being used,
-  so that we can listen on different sockets with different protocols
-  e.g. the old samba3 protocol on one socket and a new protocol on another socket
-*/
-struct wbsrv_protocol_ops {
+struct wbsrv_samconn {
+       struct wbsrv_domain *domain;
+       void *private_data;
+
+       struct composite_context (*seqnum_send)(struct wbsrv_samconn *);
+       NTSTATUS (*seqnum_recv)(struct composite_context *, uint64_t *);
+};
+
+struct wb_dom_info {
        const char *name;
-       BOOL allow_pending_calls;
-       uint32_t (*packet_length)(DATA_BLOB blob);
-       NTSTATUS (*pull_request)(DATA_BLOB blob, TALLOC_CTX *mem_ctx, struct wbsrv_call **call);
-       NTSTATUS (*handle_call)(struct wbsrv_call *call);
-       NTSTATUS (*push_reply)(struct wbsrv_call *call, TALLOC_CTX *mem_ctx, DATA_BLOB *blob);
+       const char *dns_name;
+       const struct dom_sid *sid;
+
+       int num_dcs;
+       struct nbt_dc_name *dcs;
+};
+
+struct wbsrv_domain {
+       struct wbsrv_domain *next, *prev;
+
+       struct wb_dom_info *info;
+
+       /* Details for the server we are currently talking to */
+       const char *dc_address;
+       const char *dc_name;
+
+       struct libnet_context *libnet_ctx;
+
+       struct dcerpc_binding *lsa_binding;
+
+       struct dcerpc_binding *samr_binding;
+
+       struct dcerpc_pipe *netlogon_pipe;
+       struct dcerpc_binding *netlogon_binding;
 };
 
 /*
@@ -56,8 +81,7 @@ struct wbsrv_protocol_ops {
 struct wbsrv_listen_socket {
        const char *socket_path;
        struct wbsrv_service *service;
-       BOOL privileged;
-       const struct wbsrv_protocol_ops *ops;
+       bool privileged;
 };
 
 /*
@@ -73,19 +97,30 @@ struct wbsrv_connection {
        /* storage for protocol specific data */
        void *protocol_private_data;
 
-       /* the partial data we've receiced yet */
-       DATA_BLOB partial;
+       /* how many calls are pending */
+       uint32_t pending_calls;
 
-       /* the amount that we used yet from the partial buffer */
-       uint32_t partial_read;
+       struct packet_context *packet;
 
-       /* prevent loops when we use half async code, while processing a requuest */
-       BOOL processing;
+       struct loadparm_context *lp_ctx;
+};
 
-       /* how many calls are pending */
-       uint32_t pending_calls;
+#define WBSRV_SAMBA3_SET_STRING(dest, src) do { \
+       safe_strcpy(dest, src, sizeof(dest)-1);\
+} while(0)
 
-       struct data_blob_list_item *send_queue;
+/*
+  state of a pwent query
+*/
+struct wbsrv_pwent {
+       /* Current UserList structure, contains 1+ user structs */
+       struct libnet_UserList *user_list;
+
+       /* Index of the next user struct in the current UserList struct */
+       uint32_t page_index;
+
+       /* The libnet_ctx to use for the libnet_UserList call */
+       struct libnet_context *libnet_ctx;
 };
 
 /*
@@ -106,16 +141,29 @@ struct wbsrv_connection {
      return;
 
 */
-struct wbsrv_call {
+struct wbsrv_samba3_call {
 #define WBSRV_CALL_FLAGS_REPLY_ASYNC 0x00000001
        uint32_t flags;
 
-       /* the backend should use this event context */
-       struct event_context *event_ctx;
-
        /* the connection the call belongs to */
        struct wbsrv_connection *wbconn;
 
-       /* storage for protocol specific data */
+       /* the backend should use this event context */
+       struct event_context *event_ctx;
+
+       /* here the backend can store stuff like composite_context's ... */
        void *private_data;
+
+       /* the request structure of the samba3 protocol */
+       struct winbindd_request request;
+       
+       /* the response structure of the samba3 protocol*/
+       struct winbindd_response response;
 };
+
+struct netr_LMSessionKey;
+struct netr_UserSessionKey;
+struct winbind_SamLogon;
+
+#include "winbind/wb_async_helpers.h"
+#include "winbind/wb_proto.h"