s3-epmapper: Added function to delete endpoint entries.
authorAndreas Schneider <asn@samba.org>
Wed, 16 Mar 2011 12:42:26 +0000 (13:42 +0100)
committerSimo Sorce <idra@samba.org>
Wed, 23 Mar 2011 16:19:22 +0000 (17:19 +0100)
source3/include/ntdomain.h
source3/rpc_server/epmapper/srv_epmapper.c
source3/rpc_server/epmapper/srv_epmapper.h

index 2eece8303e300b1f5bcabe7c3f9aca50e499bffa..8fb1248919fcd8e35aec38a6b020b5303cf54432 100644 (file)
@@ -109,6 +109,8 @@ struct pipe_auth_data {
        DATA_BLOB user_session_key;
 };
 
+struct dcesrv_ep_entry_list;
+
 /*
  * DCE/RPC-specific samba-internal-specific handling of data on
  * NamedPipes.
@@ -126,6 +128,7 @@ struct pipes_struct {
        struct messaging_context *msg_ctx;
 
        struct ndr_syntax_id syntax;
+       struct dcesrv_ep_entry_list *ep_entries;
 
        /* linked list of rpc dispatch tables associated 
           with the open rpc contexts */
index c43e351fdb3c86ad89337fcbdddbc2b73000e6fb..da998eb534348802dcc6b207f13876af9356cecb 100644 (file)
@@ -59,6 +59,13 @@ struct dcesrv_endpoint {
        struct dcesrv_iface_list *iface_list;
 };
 
+struct dcesrv_ep_entry_list {
+       struct dcesrv_ep_entry_list *next, *prev;
+
+       uint32_t num_ents;
+       struct epm_entry_t *entries;
+};
+
 struct rpc_eps {
        struct dcesrv_ep_iface *e;
        uint32_t count;
@@ -220,6 +227,37 @@ static bool is_priviledged_pipe(struct auth_serversupplied_info *info) {
        return true;
 }
 
+bool srv_epmapper_delete_endpoints(struct pipes_struct *p)
+{
+       struct epm_Delete r;
+       struct dcesrv_ep_entry_list *el;
+       error_status_t result;
+
+       if (p->ep_entries == NULL) {
+               return true;
+       }
+
+       for (el = p->ep_entries;
+            el != NULL;
+            el = p->ep_entries) {
+               r.in.num_ents = el->num_ents;
+               r.in.entries = el->entries;
+
+               DEBUG(10, ("Delete_endpoints for: %s\n",
+                          el->entries[0].annotation));
+
+               result = _epm_Delete(p, &r);
+               if (result != EPMAPPER_STATUS_OK) {
+                       return false;
+               }
+
+               DLIST_REMOVE(p->ep_entries, el);
+               TALLOC_FREE(el);
+       }
+
+       return true;
+}
+
 void srv_epmapper_cleanup(void)
 {
        struct dcesrv_endpoint *ep;
@@ -338,6 +376,20 @@ error_status_t _epm_Insert(struct pipes_struct *p,
                }
        }
 
+       if (r->in.num_ents > 0) {
+               struct dcesrv_ep_entry_list *el;
+
+               el = talloc_zero(p->mem_ctx, struct dcesrv_ep_entry_list);
+               if (el == NULL) {
+                       rc = EPMAPPER_STATUS_NO_MEMORY;
+                       goto done;
+               }
+               el->num_ents = r->in.num_ents;
+               el->entries = talloc_move(el, &r->in.entries);
+
+               DLIST_ADD(p->ep_entries, el);
+       }
+
        rc = EPMAPPER_STATUS_OK;
 done:
        talloc_free(tmp_ctx);
index 642117beab1b9b7d1b4e32acbee5ca2483ab65c5..1abc583e20fa0c5f73429c5aa85f8ae27f389c70 100644 (file)
@@ -27,6 +27,8 @@
  */
 void srv_epmapper_cleanup(void);
 
+bool srv_epmapper_delete_endpoints(struct pipes_struct *p);
+
 #endif /*_SRV_EPMAPPER_H_ */
 
 /* vim: set ts=8 sw=8 noet cindent syntax=c.doxygen: */