svn commit: samba r9560 - in branches/SOC/SAMBA_3_0/source: include libmsrpc libmsrpc/test

skel at samba.org skel at samba.org
Wed Aug 24 03:06:29 GMT 2005


Author: skel
Date: 2005-08-24 03:06:28 +0000 (Wed, 24 Aug 2005)
New Revision: 9560

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=9560

Log:
added cac_SamGetDisplayInfo()


Modified:
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/Makefile


Changeset:
Modified: branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
===================================================================
--- branches/SOC/SAMBA_3_0/source/include/libmsrpc.h	2005-08-24 02:11:47 UTC (rev 9559)
+++ branches/SOC/SAMBA_3_0/source/include/libmsrpc.h	2005-08-24 03:06:28 UTC (rev 9560)
@@ -312,10 +312,10 @@
    /**How many previous passwords to remember - ie, password cannot be the same as N previous passwords*/
    uint16 pass_history;
 
-   /**When password expires*/
+   /**How long (from now) before passwords expire*/
    CacTime expire;
 
-   /**When the password can be changed*/
+   /**How long (from now) before passwords can be changed*/
    CacTime min_pass_age;
 
    /**How long users are locked out for too many bad password attempts*/
@@ -1920,7 +1920,60 @@
  */
 int cac_SamGetDomainInfo(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetDomainInfo *op);
 
+struct SamGetDomainInfoCtr {
+   struct {
+      /**Open handle to domain*/
+      POLICY_HND *domain_hnd;
 
+      /**What info level you want*/
+      uint16 info_class;
+   } in;
+
+   struct {
+      SAM_UNK_CTR *info;
+   } out;
+};
+
+/**
+ * Gets domain info. Use this if you prefer to use a SAM_UNK_CTR
+ */
+int cac_SamGetDomainInfoCtr(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetDomainInfoCtr *op);
+
+/**To ensure proper functionality of this function, use ZERO_STRUCT() on the structure before setting parameters*/
+struct SamGetDisplayInfo {
+   struct {
+      /**Open handle to domain*/
+      POLICY_HND *domain_hnd;
+
+      /**What type of data*/
+      uint16 info_class;
+
+      /**(Optional)If 0, max_entries and max_size will be filled in by the function*/
+      uint32 max_entries;
+      
+      /**(Optional)If 0, max_entries and max_size will be filled in by the function*/
+      uint32 max_size;
+   } in;
+
+   struct {
+      /**Do not modify this value, use the same value between multiple calls (ie in while loop)*/
+      uint32 resume_idx;
+
+      /**Number of entries returned*/
+      uint32 num_entries;
+
+      /**Returned display info*/
+      SAM_DISPINFO_CTR ctr;
+
+      /**Internal value. Do not modify.*/
+      uint32 loop_count;
+
+      BOOL done;
+   } out;
+};
+
+int cac_SamGetDisplayInfo(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetDisplayInfo *op);
+
 void cac_GetAuthDataFn(const char * pServer,
                  const char * pShare,
                  char * pWorkgroup,

Modified: branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c
===================================================================
--- branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c	2005-08-24 02:11:47 UTC (rev 9559)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c	2005-08-24 03:06:28 UTC (rev 9560)
@@ -2139,3 +2139,113 @@
 
    return CAC_SUCCESS;
 }
+
+int cac_SamGetDomainInfoCtr(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetDomainInfoCtr *op) {
+   SMBCSRV *srv = NULL;
+
+   SAM_UNK_CTR *ctr_out;
+
+   if(!hnd) 
+      return CAC_FAILURE;
+
+   if(!hnd->_internal.ctx || !hnd->_internal.pipes[PI_SAMR]) {
+      hnd->status = NT_STATUS_INVALID_HANDLE;
+      return CAC_FAILURE;
+   }
+
+   if(!op->in.domain_hnd || op->in.info_class == 0 || !mem_ctx) {
+      hnd->status = NT_STATUS_INVALID_PARAMETER;
+      return CAC_FAILURE;
+   }
+
+   srv = cac_GetServer(hnd);
+   if(!srv) {
+      hnd->status = NT_STATUS_UNSUCCESSFUL;
+      return CAC_FAILURE;
+   }
+
+   srv->cli.pipe_idx = PI_SAMR;
+
+   ctr_out = talloc(mem_ctx, SAM_UNK_CTR);
+   if(!ctr_out) {
+      hnd->status = NT_STATUS_NO_MEMORY;
+      return CAC_FAILURE;
+   }
+
+   hnd->status = cli_samr_query_dom_info( &(srv->cli), mem_ctx, op->in.domain_hnd, op->in.info_class, ctr_out);
+
+   if(!NT_STATUS_IS_OK(hnd->status))
+      return CAC_FAILURE;
+
+   op->out.info = ctr_out;
+
+   return CAC_SUCCESS;
+}
+
+int cac_SamGetDisplayInfo(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetDisplayInfo *op) {
+   SMBCSRV *srv = NULL;
+
+   SAM_DISPINFO_CTR ctr_out;
+
+   uint32 max_entries_buf = 0;
+   uint32 max_size_buf    = 0;
+
+   uint32 resume_idx_out;
+   uint32 num_entries_out;
+
+   if(!hnd) 
+      return CAC_FAILURE;
+
+   if(!hnd->_internal.ctx || !hnd->_internal.pipes[PI_SAMR]) {
+      hnd->status = NT_STATUS_INVALID_HANDLE;
+      return CAC_FAILURE;
+   }
+
+   if(!op->in.domain_hnd || op->in.info_class == 0 || !mem_ctx) {
+      hnd->status = NT_STATUS_INVALID_PARAMETER;
+      return CAC_FAILURE;
+   }
+
+   if(op->out.done == True) /*this is done so we can use the function as a loop condition*/
+      return CAC_FAILURE;
+
+   srv = cac_GetServer(hnd);
+   if(!srv) {
+      hnd->status = NT_STATUS_UNSUCCESSFUL;
+      return CAC_FAILURE;
+   }
+
+   srv->cli.pipe_idx = PI_SAMR;
+
+   if(op->in.max_entries == 0 || op->in.max_size == 0) {
+      get_query_dispinfo_params(op->out.loop_count, &max_entries_buf, &max_size_buf);
+   }
+   else {
+      max_entries_buf = op->in.max_entries;
+      max_size_buf    = op->in.max_size;
+   }
+
+   resume_idx_out = op->out.resume_idx;
+
+   hnd->status = cli_samr_query_dispinfo( &(srv->cli), mem_ctx, op->in.domain_hnd, &resume_idx_out, op->in.info_class, 
+                                             &num_entries_out, max_entries_buf, max_size_buf, &ctr_out);
+
+   if(!NT_STATUS_IS_OK(hnd->status) && !NT_STATUS_EQUAL(hnd->status, STATUS_MORE_ENTRIES)) {
+      /*be defensive, maybe they'll call again without zeroing the struct*/ 
+      op->out.loop_count = 0;       
+      op->out.resume_idx = 0;
+      return CAC_FAILURE;
+   }
+
+   if(NT_STATUS_IS_OK(hnd->status)) {
+      /*we want to quit once the function is called next. so it can be used in a loop*/
+      op->out.done = True;
+   }
+
+   op->out.resume_idx  = resume_idx_out;
+   op->out.num_entries = num_entries_out;
+   op->out.ctr         = ctr_out;
+   op->out.loop_count++;
+
+   return CAC_SUCCESS;
+}

Modified: branches/SOC/SAMBA_3_0/source/libmsrpc/test/Makefile
===================================================================
--- branches/SOC/SAMBA_3_0/source/libmsrpc/test/Makefile	2005-08-24 02:11:47 UTC (rev 9559)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/test/Makefile	2005-08-24 03:06:28 UTC (rev 9560)
@@ -98,5 +98,8 @@
 dominfo: sam/dominfo.o test_util.o
 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< test_util.o $(LIBS)
 
+dispinfo: sam/dispinfo.o test_util.o
+	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< test_util.o $(LIBS)
+
 clean:
 	rm -f $(TESTS) *.o lsa/*.o reg/*.o sam/*.o



More information about the samba-cvs mailing list