svn commit: samba r9836 - in branches/SOC/SAMBA_3_0/examples/libmsrpc/test: . lsa reg sam smbc_test svcctl

2005-08-31 Thread skel
Author: skel
Date: 2005-08-31 19:16:20 + (Wed, 31 Aug 2005)
New Revision: 9836

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9836

Log:
added simple program to test libsmbclient compatibility
changed a paramater in cac_NewServerHandle() - fixed all the test code build 
issues


Added:
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/smbc_test/
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/smbc_test/smbc.c
Modified:
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/Makefile
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/README
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/lsa/ear.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/lsa/lsaenum.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/lsa/lsaenumprivs.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/lsa/lsapol.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/lsa/lsapriv.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/lsa/lsaq.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/lsa/lsatrust.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/regdelete.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/regkey.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/regkeycreate.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/regkeyenum.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/regopen.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/regopenkey.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/regqueryval.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/regsetval.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/regvalenum.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/security.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/shutdown.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/regdelete.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/sam/adduser.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/sam/disable.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/sam/dominfo.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/sam/enable.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/sam/samenum.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/sam/samgroup.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/sam/samlookup.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/sam/samuser.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/svcctl/svc.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/test_util.c


Changeset:
Sorry, the patch is too large (672 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9836


svn commit: samba r9837 - in branches/SOC/SAMBA_3_0/source: . include libmsrpc

2005-08-31 Thread skel
Author: skel
Date: 2005-08-31 19:20:00 + (Wed, 31 Aug 2005)
New Revision: 9837

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9837

Log:
cac_NewServerHandle() now allocates buffers for fields in the server handle, if 
asked to

cac_FreeHandle() checks for and pipe sessions and closes them


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


Changeset:
Sorry, the patch is too large (300 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9837


svn commit: samba r9839 - in branches/SOC/SAMBA_3_0/source/include: .

2005-08-31 Thread skel
Author: skel
Date: 2005-08-31 20:33:32 + (Wed, 31 Aug 2005)
New Revision: 9839

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9839

Log:
fixed up doxygen comments


Modified:
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h


Changeset:
Sorry, the patch is too large (459 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9839


svn commit: samba r9840 - in branches/SOC/SAMBA_3_0/examples/libmsrpc/test: .

2005-08-31 Thread skel
Author: skel
Date: 2005-08-31 20:42:24 + (Wed, 31 Aug 2005)
New Revision: 9840

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9840

Log:
removed useless copy of a file


Removed:
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/regdelete.c


Changeset:
Deleted: branches/SOC/SAMBA_3_0/examples/libmsrpc/test/regdelete.c
===
--- branches/SOC/SAMBA_3_0/examples/libmsrpc/test/regdelete.c   2005-08-31 
20:33:32 UTC (rev 9839)
+++ branches/SOC/SAMBA_3_0/examples/libmsrpc/test/regdelete.c   2005-08-31 
20:42:24 UTC (rev 9840)
@@ -1,95 +0,0 @@
-#include libmsrpc.h
-#include test_util.h
-
-int main(int argc, char **argv) {
-   CacServerHandle *hnd = NULL;
-   TALLOC_CTX *mem_ctx  = NULL;
-
-   fstring tmp;
-   char input = 'v';
-   
-   mem_ctx = talloc_init(regsetval);
-
-   hnd = cac_NewServerHandle(True);
-
-   cac_SetAuthDataFn(hnd, cactest_GetAuthDataFn);
-
-   cac_parse_cmd_line(argc, argv, hnd);
-
-   if(!cac_Connect(hnd, NULL)) {
-  fprintf(stderr, Could not connect to server %s. Error: %s\n, 
hnd-server, nt_errstr(hnd-status));
-  exit(-1);
-   }
-
-   printf(enter key to open: \n);
-   cactest_readline(stdin, tmp);
-
-   struct RegOpenKey rok;
-   ZERO_STRUCT(rok);
-
-   rok.in.name = talloc_strdup(mem_ctx, tmp);
-   rok.in.access = REG_KEY_ALL;
-
-   if(!cac_RegOpenKey(hnd, mem_ctx, rok)) {
-  fprintf(stderr, Could not open key %s. Error %s\n, rok.in.name, 
nt_errstr(hnd-status));
-  exit(-1);
-   }
-
-   printf(getting version (just for testing\n);
-
-   struct RegGetVersion rgv;
-   ZERO_STRUCT(rgv);
-
-   rgv.in.key = rok.out.key;
-
-   if(!cac_RegGetVersion(hnd, mem_ctx, rgv))
-  fprintf(stderr, Could not get version. Error: %s\n, 
nt_errstr(hnd-status));
-   else
-  printf(Version: %d\n, rgv.out.version);
-
-
-   while(input == 'v' || input == 'k') {
-  printf(Delete [v]alue [k]ey or [q]uit: );
-  scanf(%c, input);
-
-  switch(input) {
- case 'v':
-printf(Value to delete: );
-cactest_readline(stdin, tmp);
-
-struct RegDeleteValue rdv;
-ZERO_STRUCT(rdv);
-
-rdv.in.parent_key = rok.out.key;
-rdv.in.val_name   = talloc_strdup(mem_ctx, tmp);
-
-if(!cac_RegDeleteValue(hnd, mem_ctx, rdv))
-   fprintf(stderr, Could not delete value %s. Error: %s\n, 
rdv.in.val_name, nt_errstr(hnd-status));
-
-break;
- case 'k':
-printf(Key to delete: );
-cactest_readline(stdin, tmp);
-
-struct RegDeleteKey rdk;
-ZERO_STRUCT(rdk);
-
-rdk.in.parent_key = rok.out.key;
-rdk.in.key_name   = talloc_strdup(mem_ctx, tmp);
-
-if(!cac_RegDeleteKey(hnd, mem_ctx, rdk))
-   fprintf(stderr, Could not delete key %s. Error %s\n, 
rdk.in.key_name, nt_errstr(hnd-status));
-
-break;
-  }
-   }
-   cac_RegClose(hnd, mem_ctx, rok.out.key);
-
-   cac_FreeHandle(hnd);
-
-   talloc_destroy(mem_ctx);
-
-   return 0;
-}
-
-



svn commit: samba r9841 - in branches/SOC/SAMBA_3_0/examples/libmsrpc/cacusermgr: .

2005-08-31 Thread skel
Author: skel
Date: 2005-08-31 20:46:06 + (Wed, 31 Aug 2005)
New Revision: 9841

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9841

Log:
make clean actually deletes the right files now


Modified:
   branches/SOC/SAMBA_3_0/examples/libmsrpc/cacusermgr/Makefile


Changeset:
Modified: branches/SOC/SAMBA_3_0/examples/libmsrpc/cacusermgr/Makefile
===
--- branches/SOC/SAMBA_3_0/examples/libmsrpc/cacusermgr/Makefile
2005-08-31 20:42:24 UTC (rev 9840)
+++ branches/SOC/SAMBA_3_0/examples/libmsrpc/cacusermgr/Makefile
2005-08-31 20:46:06 UTC (rev 9841)
@@ -19,4 +19,4 @@
$(CC) $(CFLAGS) -c $ -o $@
 
 clean:
-   rm -f *.o cacusrmgr
+   rm -f *.o cacusermgr



svn commit: samba r9843 - in branches/SOC/SAMBA_3_0/examples/libmsrpc/test: lsa reg sam

2005-08-31 Thread skel
Author: skel
Date: 2005-08-31 21:09:59 + (Wed, 31 Aug 2005)
New Revision: 9843

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9843

Log:
added/fixed descriptions of test code


Modified:
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/lsa/lsaenum.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/lsa/lsaenumprivs.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/lsa/lsapriv.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/lsa/lsatrust.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/regdelete.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/regkey.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/regkeycreate.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/regkeyenum.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/regopenkey.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/regqueryval.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/regsetval.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/regvalenum.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/security.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/shutdown.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/sam/disable.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/sam/enable.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/test/sam/samlookup.c


Changeset:
Modified: branches/SOC/SAMBA_3_0/examples/libmsrpc/test/lsa/lsaenum.c
===
--- branches/SOC/SAMBA_3_0/examples/libmsrpc/test/lsa/lsaenum.c 2005-08-31 
21:04:17 UTC (rev 9842)
+++ branches/SOC/SAMBA_3_0/examples/libmsrpc/test/lsa/lsaenum.c 2005-08-31 
21:09:59 UTC (rev 9843)
@@ -1,3 +1,5 @@
+/*enumerates SIDs*/
+
 #include libmsrpc.h
 #include includes.h
 

Modified: branches/SOC/SAMBA_3_0/examples/libmsrpc/test/lsa/lsaenumprivs.c
===
--- branches/SOC/SAMBA_3_0/examples/libmsrpc/test/lsa/lsaenumprivs.c
2005-08-31 21:04:17 UTC (rev 9842)
+++ branches/SOC/SAMBA_3_0/examples/libmsrpc/test/lsa/lsaenumprivs.c
2005-08-31 21:09:59 UTC (rev 9843)
@@ -1,3 +1,5 @@
+/*enumerates privileges*/
+
 #include libmsrpc.h
 #include includes.h
 

Modified: branches/SOC/SAMBA_3_0/examples/libmsrpc/test/lsa/lsapriv.c
===
--- branches/SOC/SAMBA_3_0/examples/libmsrpc/test/lsa/lsapriv.c 2005-08-31 
21:04:17 UTC (rev 9842)
+++ branches/SOC/SAMBA_3_0/examples/libmsrpc/test/lsa/lsapriv.c 2005-08-31 
21:09:59 UTC (rev 9843)
@@ -1,3 +1,5 @@
+/*tries to set privileges for an account*/
+
 #include libmsrpc.h
 #include test_util.h
 

Modified: branches/SOC/SAMBA_3_0/examples/libmsrpc/test/lsa/lsatrust.c
===
--- branches/SOC/SAMBA_3_0/examples/libmsrpc/test/lsa/lsatrust.c
2005-08-31 21:04:17 UTC (rev 9842)
+++ branches/SOC/SAMBA_3_0/examples/libmsrpc/test/lsa/lsatrust.c
2005-08-31 21:09:59 UTC (rev 9843)
@@ -1,3 +1,5 @@
+/*queries trusted domain information*/
+
 #include libmsrpc.h
 #include includes.h
 

Modified: branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/regdelete.c
===
--- branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/regdelete.c   
2005-08-31 21:04:17 UTC (rev 9842)
+++ branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/regdelete.c   
2005-08-31 21:09:59 UTC (rev 9843)
@@ -1,3 +1,5 @@
+/*tests deleting a key or value*/
+
 #include libmsrpc.h
 #include test_util.h
 

Modified: branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/regkey.c
===
--- branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/regkey.c  2005-08-31 
21:04:17 UTC (rev 9842)
+++ branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/regkey.c  2005-08-31 
21:09:59 UTC (rev 9843)
@@ -1,4 +1,4 @@
-/*opens and closes a registry handle*/
+/*opens and closes a key*/
 
 #include libmsrpc.h
 

Modified: branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/regkeycreate.c
===
--- branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/regkeycreate.c
2005-08-31 21:04:17 UTC (rev 9842)
+++ branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/regkeycreate.c
2005-08-31 21:09:59 UTC (rev 9843)
@@ -1,4 +1,4 @@
-/*opens and closes a registry handle*/
+/*tests creating a registry key*/
 
 #include libmsrpc.h
 

Modified: branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/regkeyenum.c
===
--- branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/regkeyenum.c  
2005-08-31 21:04:17 UTC (rev 9842)
+++ branches/SOC/SAMBA_3_0/examples/libmsrpc/test/reg/regkeyenum.c  
2005-08-31 21:09:59 UTC (rev 9843)
@@ -1,4 +1,4 @@
-/*opens and closes a registry handle*/
+/*tests enumerating keys or values*/
 
 #include libmsrpc.h
 

Modified: branches/SOC/SAMBA_3_0

svn commit: samba r9809 - in branches/SOC/SAMBA_3_0/examples/libmsrpc/cacusermgr: .

2005-08-30 Thread skel
Author: skel
Date: 2005-08-30 19:44:33 + (Tue, 30 Aug 2005)
New Revision: 9809

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9809

Log:
added the group functionality


Modified:
   branches/SOC/SAMBA_3_0/examples/libmsrpc/cacusermgr/cacusermgr.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/cacusermgr/cacusermgr.h
   branches/SOC/SAMBA_3_0/examples/libmsrpc/cacusermgr/mgr_group.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/cacusermgr/mgr_user.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/cacusermgr/util.c


Changeset:
Sorry, the patch is too large (425 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9809


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

2005-08-30 Thread skel
Author: skel
Date: 2005-08-30 20:12:11 + (Tue, 30 Aug 2005)
New Revision: 9810

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9810

Log:
cac_SamGetNamesFromRids() and cac_SamGetRidsFromNames() now return success if 
num_rids or num_names is 0

added cac_SamFlush()


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


Changeset:
Modified: branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
===
--- branches/SOC/SAMBA_3_0/source/include/libmsrpc.h2005-08-30 19:44:33 UTC 
(rev 9809)
+++ branches/SOC/SAMBA_3_0/source/include/libmsrpc.h2005-08-30 20:12:11 UTC 
(rev 9810)
@@ -1782,7 +1782,7 @@
} in;
 
struct {
-  /**the number of names returned*/
+  /**the number of names returned - if this is 0, the map is NULL*/
   uint32 num_names;
 
   /**array contiaing the Names and RIDs*/
@@ -1813,7 +1813,7 @@
} in;
 
struct {
-  /**the number of names returned*/
+  /**the number of names returned - if this is 0, then map is NULL*/
   uint32 num_rids;
 
   /**array contiaing the Names and RIDs*/
@@ -2673,6 +2673,30 @@
  */
 int cac_SamGetSecurityObject(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct 
SamGetSecurityObject *op);
 
+struct SamFlush {
+   struct {
+  /**Open handle to the domain SAM*/
+  POLICY_HND *dom_hnd;
+
+  /**(Optional)Domain SID. If NULL, the domain in hnd-domain will be 
opened*/
+  DOM_SID *sid;
+
+  /**(Optional)Desired access to re-open the domain with. If 0, 
MAXIMUM_ALLOWED_ACCESS is used.*/
+  uint32 access;
+   } in;
+};
+
+/**
+ * Closes the domain handle, then re-opens it - effectively flushing any 
changes made.
+ * WARNING: if this fails you will no longer have an open handle to the domain 
SAM.
+ * @param hnd Initialized and connected server handle
+ * @param mem_ctx Context for memory allocation
+ * @param op Initialized Parameters
+ * @return CAC_FAILURE - the operation was not successful hnd-status is set 
appropriately
+ * CAC_SUCCESS - the operation was successful
+ */
+int cac_SamFlush(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamFlush 
*op);
+
 /[EMAIL PROTECTED]/ /*SAM_Functions*/
 
 /[EMAIL PROTECTED] SCM_Functions Service Control Manager Functions

Modified: branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c
===
--- branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c   2005-08-30 19:44:33 UTC 
(rev 9809)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c   2005-08-30 20:12:11 UTC 
(rev 9810)
@@ -479,11 +479,22 @@
   return CAC_FAILURE;
}
 
-   if(!op || !op-in.dom_hnd || !op-in.rids || op-in.num_rids == 0 || 
!mem_ctx) {
+   if(!op || !op-in.dom_hnd || !mem_ctx) {
   hnd-status = NT_STATUS_INVALID_PARAMETER;
   return CAC_FAILURE;
}
 
+   if(!op-in.rids  op-in.num_rids != 0) {
+  hnd-status = NT_STATUS_INVALID_PARAMETER;
+  return CAC_FAILURE;
+   }
+
+   if(op-in.num_rids == 0) {
+  /*nothing to do*/
+  op-out.num_names = 0;
+  return CAC_SUCCESS;
+   }
+
srv = cac_GetServer(hnd);
if(!srv) {
   hnd-status = NT_STATUS_INVALID_CONNECTION;
@@ -548,11 +559,22 @@
   return CAC_FAILURE;
}
 
-   if(!op || !op-in.dom_hnd || !op-in.names || op-in.num_names == 0 || 
!mem_ctx) {
+   if(!op || !op-in.dom_hnd || !mem_ctx) {
   hnd-status = NT_STATUS_INVALID_PARAMETER;
   return CAC_FAILURE;
}
 
+   if(!op-in.names  op-in.num_names != 0) {
+  hnd-status = NT_STATUS_INVALID_PARAMETER;
+  return CAC_FAILURE;
+   }
+
+   if(op-in.num_names == 0) {
+  /*then we don't have to do anything*/
+  op-out.num_rids = 0;
+  return CAC_SUCCESS;
+   }
+
srv = cac_GetServer(hnd);
if(!srv) {
   hnd-status = NT_STATUS_INVALID_CONNECTION;
@@ -850,7 +872,6 @@
 
srv-cli.pipe_idx = PI_SAMR;
 
-   printf(addgroupmember: adding rid 0x%x\n, op-in.rid);
hnd-status = cli_samr_add_groupmem( (srv-cli), mem_ctx, 
op-in.group_hnd, op-in.rid);
 
if(!NT_STATUS_IS_OK(hnd-status))
@@ -2395,3 +2416,47 @@
 
return CAC_SUCCESS;
 }
+
+int cac_SamFlush(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamFlush 
*op) {
+   SMBCSRV *srv = NULL;
+
+   struct SamOpenDomain od;
+
+   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 || !op-in.dom_hnd || !mem_ctx) {
+  hnd-status = NT_STATUS_INVALID_PARAMETER;
+  return CAC_FAILURE;
+   }
+
+   srv = cac_GetServer(hnd);
+   if(!srv) {
+  hnd-status = NT_STATUS_INVALID_CONNECTION;
+  return CAC_FAILURE;
+   }
+
+   srv-cli.pipe_idx = PI_SAMR;
+
+   if(!cac_SamClose(hnd, mem_ctx, op-in.dom_hnd))
+  return CAC_FAILURE;
+
+   ZERO_STRUCT(od);
+   od.in.access = (op-in.access) ? op-in.access

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

2005-08-30 Thread skel
Author: skel
Date: 2005-08-30 21:54:54 + (Tue, 30 Aug 2005)
New Revision: 9812

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9812

Log:
cac_Connect() now makes sure that memory is allocated for all necessary fields 
of the server handle
also copies any automagically initialized values after smbc_init_context()


Modified:
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_lsarpc.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc.c


Changeset:
Sorry, the patch is too large (253 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9812


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

2005-08-29 Thread skel
Author: skel
Date: 2005-08-29 15:55:15 + (Mon, 29 Aug 2005)
New Revision: 9745

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9745

Log:
CacLookupRidsRecord now stores a type, user or group


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


Changeset:
Modified: branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
===
--- branches/SOC/SAMBA_3_0/source/include/libmsrpc.h2005-08-29 15:54:10 UTC 
(rev 9744)
+++ branches/SOC/SAMBA_3_0/source/include/libmsrpc.h2005-08-29 15:55:15 UTC 
(rev 9745)
@@ -164,13 +164,20 @@
  * @defgroup sam_defs SAM Definitions
  * @{
  */
-struct cac_LookupRidsRecord {
+typedef struct _CACLOOKUPRIDSRECORD {
char *name;
uint32 rid;
+
+   /**If found, this will be one of:
+* - USER_RID_TYPE
+* - GROUP_RID_TYPE
+* (found in include/rpc_misc.h)
+*/
+   uint32 type;

/*if the name or RID was looked up, then found = True*/
BOOL found;
-};
+} CacLookupRidsRecord;
 
 typedef struct _CACUSERINFO {
/**Last logon time*/
@@ -1779,7 +1786,7 @@
   uint32 num_names;
 
   /**array contiaing the Names and RIDs*/
-  struct cac_LookupRidsRecord *map;
+  CacLookupRidsRecord *map;
} out;
 };
 
@@ -1810,7 +1817,7 @@
   uint32 num_rids;
 
   /**array contiaing the Names and RIDs*/
-  struct cac_LookupRidsRecord *map;
+  CacLookupRidsRecord *map;
} out;
 };
 

Modified: branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c
===
--- branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c   2005-08-29 15:54:10 UTC 
(rev 9744)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c   2005-08-29 15:55:15 UTC 
(rev 9745)
@@ -22,7 +22,6 @@
 #include libmsrpc_internal.h
 
 /*used by cac_SamGetNamesFromRids*/
-#define SAMR_RID_FOUND   1
 #define SAMR_RID_UNKNOWN 8
 
 #define SAMR_ENUM_MAX_SIZE 0x
@@ -470,7 +469,7 @@
 
uint32 i = 0;
 
-   struct cac_LookupRidsRecord *map_out;
+   CacLookupRidsRecord *map_out;
 
if(!hnd) 
   return CAC_FAILURE;
@@ -498,7 +497,7 @@
if(!NT_STATUS_IS_OK(hnd-status)  !NT_STATUS_EQUAL(hnd-status, 
STATUS_SOME_UNMAPPED))
   return CAC_FAILURE;
 
-   map_out = TALLOC_ARRAY(mem_ctx, struct cac_LookupRidsRecord, num_names_out);
+   map_out = TALLOC_ARRAY(mem_ctx, CacLookupRidsRecord, num_names_out);
if(!map_out) {
   hnd-status = NT_STATUS_NO_MEMORY;
   return CAC_FAILURE;
@@ -508,10 +507,12 @@
   if(name_types_out[i] == SAMR_RID_UNKNOWN) {
  map_out[i].found = False;
  map_out[i].name  = NULL;
+ map_out[i].type  = 0;
   }
   else {
  map_out[i].found = True;
  map_out[i].name = talloc_strdup(mem_ctx, names_out[i]);
+ map_out[i].type = name_types_out[i];
   }
   map_out[i].rid = op-in.rids[i];
}
@@ -537,7 +538,7 @@
 
uint32 i = 0;
 
-   struct cac_LookupRidsRecord *map_out;
+   CacLookupRidsRecord *map_out;
 
if(!hnd) 
   return CAC_FAILURE;
@@ -566,20 +567,23 @@
if(!NT_STATUS_IS_OK(hnd-status)  !NT_STATUS_EQUAL(hnd-status, 
STATUS_SOME_UNMAPPED))
   return CAC_FAILURE;
 
-   map_out = TALLOC_ARRAY(mem_ctx, struct cac_LookupRidsRecord, num_rids_out);
+   map_out = TALLOC_ARRAY(mem_ctx, CacLookupRidsRecord, num_rids_out);
if(!map_out) {
   hnd-status = NT_STATUS_NO_MEMORY;
   return CAC_FAILURE;
}
 
for(i = 0; i  num_rids_out; i++) {
+
   if(rid_types_out[i] == SAMR_RID_UNKNOWN) {
  map_out[i].found = False;
  map_out[i].rid   = 0;
+ map_out[i].type  = 0;
   }
   else {
  map_out[i].found = True;
  map_out[i].rid   = rids_out[i];
+ map_out[i].type  = rid_types_out[i];
   }
 
   map_out[i].name = talloc_strdup(mem_ctx, op-in.names[i]);



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

2005-08-29 Thread skel
Author: skel
Date: 2005-08-29 20:51:21 + (Mon, 29 Aug 2005)
New Revision: 9757

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9757

Log:
cac_SamEnableUser() and cac_SamDisableUser() now use cli_samr_set_userinfo2()


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


Changeset:
Modified: branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
===
--- branches/SOC/SAMBA_3_0/source/include/libmsrpc.h2005-08-29 20:18:51 UTC 
(rev 9756)
+++ branches/SOC/SAMBA_3_0/source/include/libmsrpc.h2005-08-29 20:51:21 UTC 
(rev 9757)
@@ -164,14 +164,17 @@
  * @defgroup sam_defs SAM Definitions
  * @{
  */
+
+#define CAC_USER_RID  0x1
+#define CAC_GROUP_RID 0x2
+
 typedef struct _CACLOOKUPRIDSRECORD {
char *name;
uint32 rid;
 
/**If found, this will be one of:
-* - USER_RID_TYPE
-* - GROUP_RID_TYPE
-* (found in include/rpc_misc.h)
+* - CAC_USER_RID
+* - CAC_GROUP_RID
 */
uint32 type;

@@ -1668,7 +1671,7 @@
   char *name;
 
   /**See Allowable account control bits in include/smb.h*/
-  uint32 acb;
+  uint32 acb_mask;
} in;
 
struct {

Modified: branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c
===
--- branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c   2005-08-29 20:18:51 UTC 
(rev 9756)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c   2005-08-29 20:51:21 UTC 
(rev 9757)
@@ -342,7 +342,7 @@
   return CAC_FAILURE;
}
 
-   if(!op || !op-in.dom_hnd || !op-in.name || op-in.acb == 0 || !mem_ctx) {
+   if(!op || !op-in.dom_hnd || !op-in.name || op-in.acb_mask == 0 || 
!mem_ctx) {
   hnd-status = NT_STATUS_INVALID_PARAMETER;
   return CAC_FAILURE;
}
@@ -361,7 +361,7 @@
   return CAC_FAILURE;
}
 
-   hnd-status = cli_samr_create_dom_user( (srv-cli), mem_ctx, 
op-in.dom_hnd, op-in.name, op-in.acb, unknown, user_out, rid_out);
+   hnd-status = cli_samr_create_dom_user( (srv-cli), mem_ctx, 
op-in.dom_hnd, op-in.name, op-in.acb_mask, unknown, user_out, rid_out);
 
if(!NT_STATUS_IS_OK(hnd-status))
   return CAC_FAILURE;
@@ -1582,15 +1582,15 @@
srv-cli.pipe_idx = PI_SAMR;
 
/*info_level = 21 is the only level that I have found to work reliably. It 
would be nice if user_level = 10 worked.*/
-   hnd-status = cli_samr_query_userinfo( (srv-cli), mem_ctx, user_hnd, 21, 
ctr);
+   hnd-status = cli_samr_query_userinfo( (srv-cli), mem_ctx, user_hnd, 
0x10, ctr);
 
if(!NT_STATUS_IS_OK(hnd-status))
   return CAC_FAILURE;
 
/**check the ACB mask*/
-   if((ctr-info.id21-acb_info  ACB_DISABLED) == ACB_DISABLED) {
+   if((ctr-info.id10-acb_info  ACB_DISABLED) == ACB_DISABLED) {
   /*toggle the disabled bit*/
-  ctr-info.id21-acb_info ^= ACB_DISABLED;
+  ctr-info.id10-acb_info ^= ACB_DISABLED;
}
else {
   /*the user is already enabled so just return success*/
@@ -1598,8 +1598,9 @@
}
 
/*now set the userinfo*/
-   hnd-status = cli_samr_set_userinfo( (srv-cli), mem_ctx, user_hnd, 0x10, 
(srv-cli.user_session_key), ctr);
+   hnd-status = cli_samr_set_userinfo2( (srv-cli), mem_ctx, user_hnd, 0x10, 
(srv-cli.user_session_key), ctr);
 
+   /*this will only work properly if we use set_userinfo2 - fail if it is not 
supported*/
if(!NT_STATUS_IS_OK(hnd-status))
   return CAC_FAILURE;
 
@@ -1645,8 +1646,10 @@
/*toggle the disabled bit*/
ctr-info.id10-acb_info ^= ACB_DISABLED;
 
-   hnd-status = cli_samr_set_userinfo( (srv-cli), mem_ctx, user_hnd, 0x10, 
(srv-cli.user_session_key), ctr);
+   /*this will only work properly if we use set_userinfo2*/
+   hnd-status = cli_samr_set_userinfo2( (srv-cli), mem_ctx, user_hnd, 0x10, 
(srv-cli.user_session_key), ctr);
 
+   /*this will only work properly if we use set_userinfo2 fail if it is not 
supported*/
if(!NT_STATUS_IS_OK(hnd-status))
   return CAC_FAILURE;
 



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

2005-08-29 Thread skel
Author: skel
Date: 2005-08-29 23:03:14 + (Mon, 29 Aug 2005)
New Revision: 9764

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9764

Log:
cac_SamSetUserInfo() now works with a SAM_USER_INFO_21 instead of 
SAM_USER_INFO_23


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/libmsrpc_internal.c


Changeset:
Modified: branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
===
--- branches/SOC/SAMBA_3_0/source/include/libmsrpc.h2005-08-29 22:04:11 UTC 
(rev 9763)
+++ branches/SOC/SAMBA_3_0/source/include/libmsrpc.h2005-08-29 23:03:14 UTC 
(rev 9764)
@@ -254,9 +254,6 @@
/**Possible logon hours*/
LOGON_HRS *logon_hours;
 
-   /**this must be set when calling cac_SamSetUserInfo()*/
-   char *new_password;
-   
 } CacUserInfo;
 
 typedef struct _CACGROUPINFO {

Modified: branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c
===
--- branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c   2005-08-29 22:04:11 UTC 
(rev 9763)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c   2005-08-29 23:03:14 UTC 
(rev 9764)
@@ -1776,11 +1776,11 @@
srv-cli.pipe_idx = PI_SAMR;
 
if(hnd-_internal.srv_level = SRV_WIN_NT4) {
-  hnd-status = cli_samr_set_userinfo2( (srv-cli), mem_ctx, 
op-in.user_hnd, 23, (srv-cli.user_session_key), ctr);
+  hnd-status = cli_samr_set_userinfo2( (srv-cli), mem_ctx, 
op-in.user_hnd, 21, (srv-cli.user_session_key), ctr);
}
 
if(hnd-_internal.srv_level  SRV_WIN_NT4 || !NT_STATUS_IS_OK(hnd-status)) 
{
-  hnd-status = cli_samr_set_userinfo( (srv-cli), mem_ctx, 
op-in.user_hnd, 23, (srv-cli.user_session_key), ctr);
+  hnd-status = cli_samr_set_userinfo( (srv-cli), mem_ctx, 
op-in.user_hnd, 21, (srv-cli.user_session_key), ctr);
 
   if(NT_STATUS_IS_OK(hnd-status)  hnd-_internal.srv_level  
SRV_WIN_NT4) {
  hnd-_internal.srv_level = SRV_WIN_NT4;

Modified: branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc_internal.c
===
--- branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc_internal.c  2005-08-29 
22:04:11 UTC (rev 9763)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc_internal.c  2005-08-29 
23:03:14 UTC (rev 9764)
@@ -310,7 +310,16 @@
NTTIME pass_can_change_time;
NTTIME pass_must_change_time;
 
-   uchar pw[516];
+   UNISTR2 user_name;
+   UNISTR2 full_name;
+   UNISTR2 home_dir;
+   UNISTR2 dir_drive;
+   UNISTR2 log_scr;
+   UNISTR2 prof_path;
+   UNISTR2 desc;
+   UNISTR2 wkstas;
+   UNISTR2 mung_dial;
+   UNISTR2 unk;
 
ctr = talloc(mem_ctx, SAM_USERINFO_CTR);
if(!ctr)
@@ -318,13 +327,13 @@
 
ZERO_STRUCTP(ctr-info.id23);
 
-   ctr-info.id23 = talloc(mem_ctx, SAM_USER_INFO_23);
-   if(!ctr-info.id23)
+   ctr-info.id21 = talloc(mem_ctx, SAM_USER_INFO_21);
+   if(!ctr-info.id21)
   return NULL;
 
-   ctr-switch_value = 23;
+   ctr-switch_value = 21;
 
-   ZERO_STRUCTP(ctr-info.id23);
+   ZERO_STRUCTP(ctr-info.id21);
 
unix_to_nt_time(logon_time, info-logon_time);
unix_to_nt_time(logoff_time, info-logoff_time);
@@ -333,28 +342,40 @@
unix_to_nt_time(pass_can_change_time, info-pass_can_change_time);
unix_to_nt_time(pass_must_change_time, info-pass_must_change_time);
 
-   encode_pw_buffer(pw, info-new_password, STR_UNICODE);
-   
+   /*initialize the strings*/
+   init_unistr2(user_name, info-username, STR_TERMINATE);
+   init_unistr2(full_name, info-full_name, STR_TERMINATE);
+   init_unistr2(home_dir, info-home_dir, STR_TERMINATE);
+   init_unistr2(dir_drive, info-home_drive, STR_TERMINATE);
+   init_unistr2(log_scr, info-logon_script, STR_TERMINATE);
+   init_unistr2(prof_path, info-profile_path, STR_TERMINATE);
+   init_unistr2(desc, info-description, STR_TERMINATE);
+   init_unistr2(wkstas, info-workstations, STR_TERMINATE);
+   init_unistr2(unk, \0, STR_TERMINATE);
+   init_unistr2(mung_dial, info-dial, STR_TERMINATE);
+
/*manually set passmustchange*/
-   ctr-info.id23-passmustchange = (info-pass_must_change) ? 0x01 : 0x00;
+   ctr-info.id21-passmustchange = (info-pass_must_change) ? 0x01 : 0x00;
 
-   init_sam_user_info23A(ctr-info.id23,
+   init_sam_user_info21W(ctr-info.id21,
  logon_time,
  logoff_time,
  kickoff_time,
  pass_last_set_time,
  pass_can_change_time,
  pass_must_change_time,
- info-username,
- info-full_name,
- info-home_dir,
- info-home_drive,
- info-logon_script,
- info-profile_path,
- info-description,
- info-workstations

svn commit: samba r9765 - in branches/SOC/SAMBA_3_0/examples/libmsrpc/cacusermgr: .

2005-08-29 Thread skel
Author: skel
Date: 2005-08-29 23:05:26 + (Mon, 29 Aug 2005)
New Revision: 9765

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9765

Log:
added create account/group functions and some of the user functionality


Added:
   branches/SOC/SAMBA_3_0/examples/libmsrpc/cacusermgr/mgr_group.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/cacusermgr/mgr_user.c
Modified:
   branches/SOC/SAMBA_3_0/examples/libmsrpc/cacusermgr/Makefile
   branches/SOC/SAMBA_3_0/examples/libmsrpc/cacusermgr/cacusermgr.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/cacusermgr/cacusermgr.h
   branches/SOC/SAMBA_3_0/examples/libmsrpc/cacusermgr/util.c


Changeset:
Sorry, the patch is too large (764 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9765


svn commit: samba r9777 - in branches/SOC/SAMBA_3_0/examples/libmsrpc/cacusermgr: .

2005-08-29 Thread skel
Author: skel
Date: 2005-08-30 02:36:48 + (Tue, 30 Aug 2005)
New Revision: 9777

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9777

Log:
finished user functionality


Modified:
   branches/SOC/SAMBA_3_0/examples/libmsrpc/cacusermgr/cacusermgr.h
   branches/SOC/SAMBA_3_0/examples/libmsrpc/cacusermgr/mgr_group.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/cacusermgr/mgr_user.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/cacusermgr/util.c


Changeset:
Sorry, the patch is too large (366 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9777


svn commit: samba r9729 - in branches/SOC/SAMBA_3_0/examples/libmsrpc: . cacusermgr

2005-08-28 Thread skel
Author: skel
Date: 2005-08-29 04:33:45 + (Mon, 29 Aug 2005)
New Revision: 9729

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9729

Log:
started writing a user manager


Added:
   branches/SOC/SAMBA_3_0/examples/libmsrpc/cacusermgr/
   branches/SOC/SAMBA_3_0/examples/libmsrpc/cacusermgr/Makefile
   branches/SOC/SAMBA_3_0/examples/libmsrpc/cacusermgr/cacusermgr.c
   branches/SOC/SAMBA_3_0/examples/libmsrpc/cacusermgr/cacusermgr.h
   branches/SOC/SAMBA_3_0/examples/libmsrpc/cacusermgr/util.c


Changeset:
Sorry, the patch is too large (473 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9729


svn commit: samba r9730 - in branches/SOC/SAMBA_3_0/source/libmsrpc: .

2005-08-28 Thread skel
Author: skel
Date: 2005-08-29 04:36:01 + (Mon, 29 Aug 2005)
New Revision: 9730

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9730

Log:
test code has been moved to examples/libmsrpc/test


Removed:
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/


Changeset:


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

2005-08-27 Thread skel
Author: skel
Date: 2005-08-27 20:24:27 + (Sat, 27 Aug 2005)
New Revision: 9691

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9691

Log:
added cac_SvcControlService() which is straight access to 
cli_svcctl_control_service()

cac_SvcStartService() and cac_SvcStopService() now wait for a service to reach 
the desired status and support a timeout

Modified:
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_svcctl.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/svcctl/svc.c


Changeset:
Sorry, the patch is too large (424 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9691


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

2005-08-27 Thread skel
Author: skel
Date: 2005-08-27 23:08:02 + (Sat, 27 Aug 2005)
New Revision: 9697

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9697

Log:

added 
cac_SvcPauseService()
cac_SvcContinueService()
cac_SvcGetServiceConfig()


Modified:
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
   branches/SOC/SAMBA_3_0/source/include/libmsrpc_internal.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_svcctl.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc_internal.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/svcctl/svc.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/test_util.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/test_util.h


Changeset:
Sorry, the patch is too large (441 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9697


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

2005-08-25 Thread skel
Author: skel
Date: 2005-08-25 18:08:36 + (Thu, 25 Aug 2005)
New Revision: 9620

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9620

Log:
fixed up some inconsistencies in the reg functions
cac_RegCreateKey() explicitly tries to open a key now


Modified:
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_winreg.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/reg/regkeycreate.c


Changeset:
Modified: branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
===
--- branches/SOC/SAMBA_3_0/source/include/libmsrpc.h2005-08-25 17:46:13 UTC 
(rev 9619)
+++ branches/SOC/SAMBA_3_0/source/include/libmsrpc.h2005-08-25 18:08:36 UTC 
(rev 9620)
@@ -240,7 +240,6 @@
 
char *dial;
 
-   /*FIXME: is there a better interface?*/
/**Possible logon hours*/
LOGON_HRS *logon_hours;
 
@@ -428,6 +427,20 @@
  */
 void cac_InitCacTime(CacTime *cactime, NTTIME nttime);
 
+/**
+ * Default smbc_get_auth_data_fn for libmsrpc. This function is called when 
libmsrpc needs to get more information about the 
+ * client (username/password, workgroup). 
+ * This function provides simple prompts to the user to enter the information. 
This description his here so you know how to re-define this function.
+ * @see cac_SetAuthDataFn()
+ * @param pServer Name/IP of the server to connect to. 
+ * @param pShare Share name to connect to
+ * @param pWorkgroup libmsrpc passes in the workgroup/domain name from 
hnd-domain. It can be modified in the function.
+ * @param maxLenWorkGroup The maximum length of a string pWogroup can hold.
+ * @param pUsername libmsrpc passes in the username from hnd-username. It can 
be modified in the function.
+ * @param maxLenUsername The maximum length of a string pUsername can hold.
+ * @param pPassword libmsrpc pass in the password from hnd-password. It can 
be modified in the function.
+ * @param maxLenPassword The maximum length  of a string pPassword can hold.
+ */
 void cac_GetAuthDataFn(const char * pServer,
  const char * pShare,
  char * pWorkgroup,
@@ -822,7 +835,7 @@
 
 struct LsaOpenAccount {
struct {
-  /**open lsa policy handle*/
+  /**An open LSA policy handle*/
   POLICY_HND *pol;
 
   /**(Optional) account SID - must supply either sid or name*/
@@ -853,7 +866,7 @@
 
 struct LsaAddPrivileges {
struct {
-  /**An open handle to the LSA*/
+  /**An open LSA policy handle*/
   POLICY_HND *pol;
 
   /**(Optional) The user's SID (must specify at least sid or name)*/
@@ -1103,7 +1116,7 @@
 };
 
 /**
- * Creates a registry key, if the key already exists, it will be opened __This 
is not currently working__.
+ * Creates a registry key, if the key already exists, it will be opened 
__Creating keys is not currently working__.
  * @param hnd Initialized and connected server handle
  * @param mem_ctx Context for memory allocation
  * @param op Initialized Parmeters
@@ -1118,7 +1131,7 @@
   POLICY_HND *parent_key;
 
   /**name of the key to delete*/
-  char *key_name;
+  char *name;
 
   /**delete recursively. WARNING: this might not always work as planned*/
   BOOL recursive;
@@ -1143,7 +1156,7 @@
   POLICY_HND *parent_key;
 
   /**name of the value to delete*/
-  char *val_name;
+  char *name;
} in;
 };
 

Modified: branches/SOC/SAMBA_3_0/source/libmsrpc/cac_winreg.c
===
--- branches/SOC/SAMBA_3_0/source/libmsrpc/cac_winreg.c 2005-08-25 17:46:13 UTC 
(rev 9619)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/cac_winreg.c 2005-08-25 18:08:36 UTC 
(rev 9620)
@@ -305,10 +305,12 @@
 
POLICY_HND *key_out;
 
+   struct RegOpenKey rok;
+
if(!hnd) 
   return CAC_FAILURE;
 
-   if(!hnd-_internal.ctx || !hnd-_internal.pipes[PI_WINREG]) {
+   if(!hnd-_internal.ctx) {
   hnd-status = NT_STATUS_INVALID_HANDLE;
   return CAC_FAILURE;
}
@@ -324,6 +326,20 @@
   return CAC_FAILURE;
}
 
+   /*first try to open the key - we use cac_RegOpenKey(). this doubles as a 
way to ensure the winreg pipe is initialized*/
+   ZERO_STRUCT(rok);
+
+   rok.in.name = op-in.key_name;
+   rok.in.access = op-in.access;
+   rok.in.parent_key = op-in.parent_key;
+
+   if(cac_RegOpenKey(hnd, mem_ctx, rok)) {
+  /*then we got the key, return*/
+  op-out.key = rok.out.key;
+  return CAC_SUCCESS;
+   }
+
+   /*just be ultra-safe*/
srv-cli.pipe_idx = PI_WINREG;
 
key_out = talloc(mem_ctx, POLICY_HND);
@@ -406,7 +422,7 @@
   return CAC_FAILURE;
}
 
-   if(!op || !op-in.parent_key || !op-in.key_name || !mem_ctx) {
+   if(!op || !op-in.parent_key || !op-in.name || !mem_ctx) {
   hnd-status = NT_STATUS_INVALID_PARAMETER;
   return CAC_FAILURE;
}
@@ -425,7 +441,7 @@
   ZERO_STRUCT(rok);
 
   rok.in.parent_key = op-in.parent_key;
-  rok.in.name   = op

svn commit: samba r9622 - in branches/SOC/SAMBA_3_0/source: include libmsrpc libmsrpc/test libmsrpc/test/reg libmsrpc/test/sam

2005-08-25 Thread skel
Author: skel
Date: 2005-08-25 20:43:39 + (Thu, 25 Aug 2005)
New Revision: 9622

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9622

Log:
renamed a number of function parameters to make them more consistent
fixed all the build issues it caused in the test code


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
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/reg/regdelete.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/reg/regkeycreate.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/adduser.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/disable.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/dominfo.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/enable.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/samenum.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/samgroup.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/samlookup.c


Changeset:
Sorry, the patch is too large (910 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9622


svn commit: samba r9626 - in branches/SOC/SAMBA_3_0/source/libmsrpc: .

2005-08-25 Thread skel
Author: skel
Date: 2005-08-25 23:29:54 + (Thu, 25 Aug 2005)
New Revision: 9626

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9626

Log:
added support to retrieve REG_MULTI_SZ values

setting and retrieving REG_MULTI_SZ values is done 'properly' using 
rpcstr_push() and rpcstr_pull()


Modified:
   branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc_internal.c


Changeset:
Modified: branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc_internal.c
===
--- branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc_internal.c  2005-08-25 
23:05:41 UTC (rev 9625)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc_internal.c  2005-08-25 
23:29:54 UTC (rev 9626)
@@ -71,8 +71,9 @@
 
 RPC_DATA_BLOB *cac_MakeRpcDataBlob(TALLOC_CTX *mem_ctx, uint32 data_type, 
REG_VALUE_DATA data) {
RPC_DATA_BLOB *blob = NULL;
-   int i, j;
+   int i;
uint32 size = 0;
+   uint32 len  = 0;
uint8 *multi = NULL;
uint32 multi_idx = 0;
 
@@ -110,34 +111,25 @@
 size += strlen(data.reg_multi_sz.strings[i]) + 1;
  }
 
- /*have to add an additional '\0'*/
-/* size++;
-
- blob-buf_len = size;
- blob-buffer = talloc_size(mem_ctx, sizeof(uint8) * size);
-
- if(blob-buffer) {
-memcpy(blob-buffer, data.reg_multi_sz.strings, size);
-blob-buffer[size - 1] = '\0';
- }
-*/
  /**need a whole bunch of unicode strings in a row (seperated by null 
characters), with an extra null-character on the end*/
 
- /*this is a hack.. but it works*/
  multi = TALLOC_ZERO_ARRAY(mem_ctx, uint8, (size + 1)*2); /*size +1 
for the extra null character*/
  if(!multi) {
 errno = ENOMEM;
 break;
  }
  
+ /*do it using rpcstr_push()*/
+ multi_idx = 0;
  for(i = 0; i  data.reg_multi_sz.num_strings; i++) {
-for(j = 0; j = strlen(data.reg_multi_sz.strings[i]); j++) {
-   multi[multi_idx] = data.reg_multi_sz.strings[i][j];
+len = strlen(data.reg_multi_sz.strings[i]) + 1;
 
-   multi_idx += 2;
-}
- }
+rpcstr_push((multi + multi_idx), data.reg_multi_sz.strings[i], len 
* 2, STR_TERMINATE);
 
+/* x2 becuase it is a uint8 buffer*/
+multi_idx += len * 2;
+ }
+
  /*now initialize the buffer as binary data*/
  init_rpc_blob_bytes(blob, multi, (size + 1)*2);
 
@@ -188,8 +180,15 @@
 REG_VALUE_DATA *cac_MakeRegValueData(TALLOC_CTX *mem_ctx, uint32 data_type, 
REGVAL_BUFFER buf) {
REG_VALUE_DATA *data;
 
-   uint32 size  = 0;
+   uint32 i;
 
+   /*all of the following used for MULTI_SZ data*/
+   uint32 size   = 0;
+   uint32 len= 0;
+   uint32 multi_idx  = 0;
+   uint32 num_strings= 0;
+   char **strings= NULL;
+
data = talloc(mem_ctx, REG_VALUE_DATA);
if(!data) {
   errno = ENOMEM;
@@ -242,11 +241,7 @@
   case REG_MULTI_SZ:
  size = buf.buf_len;
 
- /*FIXME: make this do something useful*/
-#if 0
- /*find out how many strings there are*/
- i = 0;
- 
+ /*find out how many strings there are. size is # of bytes and we want 
to work uint16*/
  for(i = 0; i  (size/2 - 1); i++) {
 if(buf.buffer[i] == 0x)
num_strings++;
@@ -255,7 +250,9 @@
 if(buf.buffer[i] == 0x  buf.buffer[i + 1] == 0x)
break;
  }
-
+ 
+ printf(cac_RegMakeValueData: num_strings = %d, buf_len = %d\n, 
num_strings, buf.buf_len);
+ 
  strings = talloc_array(mem_ctx, char *, num_strings);
  if(!strings) {
 errno = ENOMEM;
@@ -267,29 +264,27 @@
 break;
 
  for(i = 0; i  num_strings; i++) {
-/*first we have to find out how long this string is*/
-cur_size = 0;
-while(buf_idx + cur_size  sizebuf.buffer[bytes_used + cur_size] 
!= 0x)
-   cur_size++;
+/*find out how many characters are in this string*/
+len = 0;
+/*make sure we don't go past the end of the buffer and keep 
looping until we have a uni \0*/
+while( multi_idx + len  size/2  buf.buffer[multi_idx + len] != 
0x)
+   len++;
 
-strings[i] = cac_unistr_to_str(mem_ctx, (buf.buffer + buf_idx), 
(size - bytes_used));
+/*stay aware of the \0\0*/
+len++;
 
-if(!strings[i]) {
-   talloc_free(strings);
-   strings = NULL;
-   break;
-}
-
-/*buf_idx is here to keep things more readable, keeps track of 
where we are in the buffer*/
-buf_idx= strlen(strings[i]) + 1;
-/*need to keep track of what's left in the buffer. buffer is 2 
bytes for letter, string is 1 byte per

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

2005-08-24 Thread skel
Author: skel
Date: 2005-08-24 22:18:27 + (Wed, 24 Aug 2005)
New Revision: 9597

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9597

Log:
cleaned up comments for Doxygen and added a doxygen config file to produce the 
docs

changed typedef of cac_SidInfo to CacSidInfo to be consistent with other 
structures


Added:
   branches/SOC/SAMBA_3_0/source/libmsrpc/Doxyfile
Modified:
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_lsarpc.c


Changeset:
Sorry, the patch is too large (2012 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9597


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

2005-08-24 Thread skel
Author: skel
Date: 2005-08-25 02:33:08 + (Thu, 25 Aug 2005)
New Revision: 9604

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9604

Log:
all functions now return NT_STATUS_INVALID_CONNECTION if no connection is 
present (instead of NT_STATUS_UNSUCCESSFUL)

fixed a bug in cac_LsaRemovePrivileges() and cac_LsaSetPrivileges(), and added 
a simple test program (lsapriv)


Added:
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/lsa/lsapriv.c
Modified:
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_lsarpc.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_winreg.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/Makefile


Changeset:
Sorry, the patch is too large (927 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9604


svn commit: samba r9525 - in branches/SOC/SAMBA_3_0/source: libmsrpc libmsrpc/test libmsrpc/test/sam rpcclient

2005-08-23 Thread skel
Author: skel
Date: 2005-08-23 15:59:25 + (Tue, 23 Aug 2005)
New Revision: 9525

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9525

Log:
fixed bug in cac_SamSetUserInfo() - it was sending the wrong flags


Modified:
   branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc_internal.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/samuser.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/test_util.c
   branches/SOC/SAMBA_3_0/source/rpcclient/cmd_samr.c


Changeset:
Modified: branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc_internal.c
===
--- branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc_internal.c  2005-08-23 
14:09:42 UTC (rev 9524)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc_internal.c  2005-08-23 
15:59:25 UTC (rev 9525)
@@ -346,35 +346,35 @@
 SAM_USERINFO_CTR *cac_MakeUserInfoCtr(TALLOC_CTX *mem_ctx, CacUserInfo *info) {
SAM_USERINFO_CTR *ctr = NULL;
 
+   /*the flags we are 'setting'- include/passdb.h*/
+   uint32 flags = ACCT_USERNAME | ACCT_FULL_NAME | ACCT_PRIMARY_GID | 
ACCT_ADMIN_DESC | ACCT_DESCRIPTION |
+ ACCT_HOME_DIR | ACCT_HOME_DRIVE | ACCT_LOGON_SCRIPT | 
ACCT_PROFILE | ACCT_WORKSTATIONS |
+  ACCT_FLAGS;
+
NTTIME logon_time;
NTTIME logoff_time;
NTTIME kickoff_time;
NTTIME pass_last_set_time;
NTTIME pass_can_change_time;
NTTIME pass_must_change_time;
-   UNISTR2 user_name;
-   UNISTR2 full_name;
-   UNISTR2 home_dir;
-   UNISTR2 dir_drive;
-   UNISTR2 log_scr;
-   UNISTR2 prof_path;
-   UNISTR2 desc;
-   UNISTR2 wkstas;
-   UNISTR2 unk_str;
-   UNISTR2 mung_dial;
+
char pw[516];
+   char dummy[1] = \0;
 
ctr = talloc(mem_ctx, SAM_USERINFO_CTR);
if(!ctr)
   return NULL;
 
+   ZERO_STRUCTP(ctr-info.id23);
+
ctr-info.id23 = talloc(mem_ctx, SAM_USER_INFO_23);
if(!ctr-info.id23)
   return NULL;
 
-   ZERO_STRUCTP(ctr-info.id23);
ctr-switch_value = 23;
 
+   ZERO_STRUCTP(ctr-info.id23);
+
unix_to_nt_time(logon_time, info-logon_time);
unix_to_nt_time(logoff_time, info-logoff_time);
unix_to_nt_time(kickoff_time, info-kickoff_time);
@@ -382,7 +382,7 @@
unix_to_nt_time(pass_can_change_time, info-pass_can_change_time);
unix_to_nt_time(pass_must_change_time, info-pass_must_change_time);
 
-   encode_pw_buffer(pw, info-new_password, STR_UNICODE);
+   encode_pw_buffer(pw, dummy, STR_UNICODE);
 

/*manually set passmustchange*/
@@ -408,12 +408,12 @@
  info-rid,
  info-group_rid,
  info-acb_mask,
- ACCT_FLAGS,
+ flags,
  168, /*logon divs*/
  info-logon_hours,
  info-bad_passwd_count,
  info-logon_count,
- pw);
+ (char *)pw);
  
return ctr;


Modified: branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/samuser.c
===
--- branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/samuser.c   2005-08-23 
14:09:42 UTC (rev 9524)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/samuser.c   2005-08-23 
15:59:25 UTC (rev 9525)
@@ -8,17 +8,21 @@
TALLOC_CTX *mem_ctx = NULL;
 

-   struct SamOpenUser   ou;
-   struct SamEnumUsers  eu;
-   struct SamCreateUser cu;
+   struct SamOpenUserou;
+   struct SamEnumUsers   eu;
+   struct SamCreateUser  cu;
struct SamGetUserInfo gi;
struct SamSetUserInfo si;
-   struct SamRenameUser ru;
+   struct SamRenameUser  ru;
+   struct SamSetPassword sp;
 
POLICY_HND *user_hnd = NULL;
 
fstring tmp;
fstring input;
+
+   char *pass1 = NULL;
+   char *pass2 = NULL;

int i;
 
@@ -55,6 +59,7 @@
   printf([g]et user info\n);
   printf([e]dit user info\n);
   printf([r]ename user\n);
+  printf(reset [p]assword\n);
   printf([n] close user\n);
 
   printf([q]uit\n\n);
@@ -237,6 +242,35 @@
 
 break;
 
+ case 'p': /*reset password*/
+
+if(!user_hnd) {
+   printf(Must open user first!\n);
+   break;
+}
+
+do {
+   if(pass1  pass2) {
+  printf(Passwords do not match. Please try again\n);
+   }
+
+   pass1 = getpass(Enter new password: );
+   pass2 = getpass(Re-enter new password: );
+} while(strncmp(pass1, pass2, MAX_PASS_LEN));
+
+ZERO_STRUCT(sp);
+sp.in.user_hnd = user_hnd;
+sp.in.password = talloc_strdup(mem_ctx, pass1);
+
+if(!cac_SamSetPassword(hnd, mem_ctx, sp)) {
+   printf(Could not set password. Error: %s\n, 
nt_errstr(hnd-status));
+}
+else {
+   printf(Done.\n);
+}
+
+break;
+
  case 'q

svn commit: samba r9531 - in branches/SOC/SAMBA_3_0/source/libmsrpc: .

2005-08-23 Thread skel
Author: skel
Date: 2005-08-23 16:47:47 + (Tue, 23 Aug 2005)
New Revision: 9531

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9531

Log:
cleaned up most of the compiler warnings


Modified:
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_lsarpc.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc_internal.c


Changeset:
Modified: branches/SOC/SAMBA_3_0/source/libmsrpc/cac_lsarpc.c
===
--- branches/SOC/SAMBA_3_0/source/libmsrpc/cac_lsarpc.c 2005-08-23 16:44:03 UTC 
(rev 9530)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/cac_lsarpc.c 2005-08-23 16:47:47 UTC 
(rev 9531)
@@ -318,7 +318,7 @@
 
/*now actually lookup the names*/
hnd-status = cli_lsa_lookup_names( (srv-cli), mem_ctx, op-in.pol, 
num_names,
-  op-in.names, sids, types);
+  (const char **)op-in.names, sids, 
types);
 
if(NT_STATUS_IS_OK(hnd-status)) {
   /*this is the easy part, just make the out.sids array*/
@@ -620,10 +620,10 @@
 
if(op-in.name  !op-in.sid) {
   DOM_SID *user_sid = NULL;
-  uint32 type;
+  uint32 *type;
 
   /*lookup the SID*/
-  hnd-status = cli_lsa_lookup_names( (srv-cli), mem_ctx, op-in.pol, 1, 
(op-in.name), user_sid, type);
+  hnd-status = cli_lsa_lookup_names( (srv-cli), mem_ctx, op-in.pol, 1, 
(const char **)(op-in.name), user_sid, type);
 
   if(!NT_STATUS_IS_OK(hnd-status))
  return CAC_FAILURE;
@@ -858,10 +858,10 @@
/*look up the user's SID if we have to*/
if(op-in.name  !op-in.sid) {
   DOM_SID *user_sid = NULL;
-  uint32 type;
+  uint32 *type;
 
   /*lookup the SID*/
-  hnd-status = cli_lsa_lookup_names( (srv-cli), mem_ctx, op-in.pol, 1, 
(op-in.name), user_sid, type);
+  hnd-status = cli_lsa_lookup_names( (srv-cli), mem_ctx, op-in.pol, 1, 
(const char **)(op-in.name), user_sid, type);
 
   if(!NT_STATUS_IS_OK(hnd-status))
  return CAC_FAILURE;
@@ -922,7 +922,7 @@
 
if(op-in.name  !op-in.sid) {
   /*lookup the SID*/
-  hnd-status = cli_lsa_lookup_names( (srv-cli), mem_ctx, op-in.pol, 1, 
(op-in.name), user_sid, type);
+  hnd-status = cli_lsa_lookup_names( (srv-cli), mem_ctx, op-in.pol, 1, 
(const char **)(op-in.name), user_sid, type);
 
   if(!NT_STATUS_IS_OK(hnd-status))
  return CAC_FAILURE;
@@ -930,7 +930,7 @@
   op-in.sid = user_sid;
}
 
-   hnd-status = cli_lsa_add_account_rights( (srv-cli), mem_ctx, op-in.pol, 
*(op-in.sid), op-in.num_privs, op-in.priv_names);
+   hnd-status = cli_lsa_add_account_rights( (srv-cli), mem_ctx, op-in.pol, 
*(op-in.sid), op-in.num_privs, (const char **)op-in.priv_names);
 
if(!NT_STATUS_IS_OK(hnd-status)) {
   return CAC_FAILURE;
@@ -964,7 +964,7 @@
   return CAC_FAILURE;
}
 
-   srv = cac_GetServer;
+   srv = cac_GetServer(hnd);
if(!srv) {
   return CAC_FAILURE;
}
@@ -973,7 +973,7 @@
 
if(op-in.name  !op-in.sid) {
   /*lookup the SID*/
-  hnd-status = cli_lsa_lookup_names( (srv-cli), mem_ctx, op-in.pol, 1, 
(op-in.name), user_sid, type);
+  hnd-status = cli_lsa_lookup_names( (srv-cli), mem_ctx, op-in.pol, 1, 
(const char **)(op-in.name), user_sid, type);
 
   if(!NT_STATUS_IS_OK(hnd-status))
  return CAC_FAILURE;
@@ -981,7 +981,7 @@
   op-in.sid = user_sid;
}
 
-   hnd-status = cli_lsa_remove_account_rights( (srv-cli), mem_ctx, 
op-in.pol, *(op-in.sid), False, op-in.num_privs, op-in.priv_names);
+   hnd-status = cli_lsa_remove_account_rights( (srv-cli), mem_ctx, 
op-in.pol, *(op-in.sid), False, op-in.num_privs, (const char 
**)op-in.priv_names);
 
if(!NT_STATUS_IS_OK(hnd-status)) {
   return CAC_FAILURE;
@@ -1024,7 +1024,7 @@
 
if(op-in.name  !op-in.sid) {
   /*lookup the SID*/
-  hnd-status = cli_lsa_lookup_names( (srv-cli), mem_ctx, op-in.pol, 1, 
(op-in.name), user_sid, type);
+  hnd-status = cli_lsa_lookup_names( (srv-cli), mem_ctx, op-in.pol, 1, 
(const char **)(op-in.name), user_sid, type);
 
   if(!NT_STATUS_IS_OK(hnd-status))
  return CAC_FAILURE;
@@ -1066,7 +1066,7 @@
   return CAC_FAILURE;
}
 
-   srv = cac_GetServer;
+   srv = cac_GetServer(hnd);
if(!srv) {
   return CAC_FAILURE;
}
@@ -1074,7 +1074,7 @@
 
if(op-in.name  !op-in.sid) {
   /*lookup the SID*/
-  hnd-status = cli_lsa_lookup_names( (srv-cli), mem_ctx, op-in.pol, 1, 
(op-in.name), user_sid, type);
+  hnd-status = cli_lsa_lookup_names( (srv-cli), mem_ctx, op-in.pol, 1, 
(const char **)(op-in.name), user_sid, type);
 
   if(!NT_STATUS_IS_OK(hnd-status))
  return CAC_FAILURE;
@@ -1089,7 +1089,7 @@
   return CAC_FAILURE;
}
 
-   hnd-status = cli_lsa_add_account_rights( (srv-cli), mem_ctx, op-in.pol, 
*(op-in.sid), op-in.num_privs, op-in.priv_names);
+   hnd-status = cli_lsa_add_account_rights( (srv-cli

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

2005-08-23 Thread skel
Author: skel
Date: 2005-08-23 20:23:43 + (Tue, 23 Aug 2005)
New Revision: 9541

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9541

Log:
added cac_GetDomainInfo() and supporting functions


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


Changeset:
Sorry, the patch is too large (340 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9541


svn commit: samba r9544 - in branches/SOC/SAMBA_3_0/source/libmsrpc/test: . sam

2005-08-23 Thread skel
Author: skel
Date: 2005-08-23 21:03:44 + (Tue, 23 Aug 2005)
New Revision: 9544

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9544

Log:
added dominfo to test cac_SamGetDomainInfo()


Added:
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/dominfo.c
Modified:
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/Makefile
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/adduser.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/test_util.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/test_util.h


Changeset:
Modified: branches/SOC/SAMBA_3_0/source/libmsrpc/test/Makefile
===
--- branches/SOC/SAMBA_3_0/source/libmsrpc/test/Makefile2005-08-23 
20:53:39 UTC (rev 9543)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/test/Makefile2005-08-23 
21:03:44 UTC (rev 9544)
@@ -9,7 +9,8 @@
 LDFLAGS=-L. -L../../bin/ 
 LIBS=../../bin/libmsrpc.so
 
-TESTS= lsapol lsaq lsaenum lsaenumprivs regkeycreate regvalenum shutdown 
regsetval regqueryval regdelete savekey security regkeyenum adduser samenum 
samlookup samgroup enable disable
+TESTS= lsapol lsaq lsaenum lsaenumprivs regkeycreate regvalenum shutdown 
regsetval regqueryval regdelete savekey security regkeyenum adduser \
+   samenum samlookup samgroup enable disable dominfo
 
 all: $(TESTS)
 
@@ -94,5 +95,8 @@
 samuser: sam/samuser.o test_util.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $ test_util.o $(LIBS)
 
+dominfo: sam/dominfo.o test_util.o
+   $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $ test_util.o $(LIBS)
+
 clean:
rm -f $(TESTS) *.o lsa/*.o reg/*.o sam/*.o

Modified: branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/adduser.c
===
--- branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/adduser.c   2005-08-23 
20:53:39 UTC (rev 9543)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/adduser.c   2005-08-23 
21:03:44 UTC (rev 9544)
@@ -35,7 +35,7 @@
   goto done;
}
 
-   struct SamCreateDomainUser cdu;
+   struct SamCreateUser cdu;
ZERO_STRUCT(cdu);
 
printf(Enter account name: );
@@ -45,7 +45,7 @@
cdu.in.username = talloc_strdup(mem_ctx, tmp);
cdu.in.acb  = ACB_NORMAL;
 
-   if(!cac_SamCreateDomainUser(hnd, mem_ctx, cdu)) {
+   if(!cac_SamCreateUser(hnd, mem_ctx, cdu)) {
   fprintf(stderr, Could not create user %s. Error: %s\n, 
cdu.in.username, nt_errstr(hnd-status));
}
 

Added: branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/dominfo.c
===
--- branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/dominfo.c   2005-08-23 
20:53:39 UTC (rev 9543)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/dominfo.c   2005-08-23 
21:03:44 UTC (rev 9544)
@@ -0,0 +1,55 @@
+/*gets domain info and prints it out*/
+
+#include libmsrpc.h
+#include test_util.h
+
+int main(int argc, char **argv) {
+   CacServerHandle *hnd = NULL;
+   TALLOC_CTX *mem_ctx = NULL;
+
+   mem_ctx = talloc_init(cac_dominfo);
+
+   hnd = cac_NewServerHandle();
+
+   cac_SetAuthDataFn(hnd, cactest_GetAuthDataFn);
+
+   cac_parse_cmd_line(argc, argv, hnd);
+
+   if(!cac_Connect(hnd, NULL)) {
+  fprintf(stderr, Could not connect to server %s. Error: %s\n, 
hnd-server, nt_errstr(hnd-status));
+  exit(-1);
+   }
+
+   struct SamOpenDomain sod;
+   ZERO_STRUCT(sod);
+
+   sod.in.access = MAXIMUM_ALLOWED_ACCESS; 
+
+   if(!cac_SamOpenDomain(hnd, mem_ctx, sod)) {
+  fprintf(stderr, Could not open domain. Error: %s\n, 
nt_errstr(hnd-status));
+  goto done;
+   }
+
+   struct SamGetDomainInfo gdi;
+   ZERO_STRUCT(gdi);
+
+   gdi.in.domain_hnd = sod.out.pol;
+
+   if(!cac_SamGetDomainInfo(hnd, mem_ctx, gdi)) {
+  fprintf(stderr, Could not get domain info. Error: %s\n, 
nt_errstr(hnd-status));
+  goto done;
+   }
+
+   printf(Got domain info:\n);
+   print_cac_domain_info(gdi.out.info);
+
+done:
+   cac_SamClose(hnd, mem_ctx, sod.out.pol);
+
+   cac_FreeHandle(hnd);
+
+   talloc_destroy(mem_ctx);
+   
+   return 0;
+}
+

Modified: branches/SOC/SAMBA_3_0/source/libmsrpc/test/test_util.c
===
--- branches/SOC/SAMBA_3_0/source/libmsrpc/test/test_util.c 2005-08-23 
20:53:39 UTC (rev 9543)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/test/test_util.c 2005-08-23 
21:03:44 UTC (rev 9544)
@@ -339,3 +339,47 @@
   info-description = talloc_strdup(mem_ctx, tmp);
 }
 
+char *srv_role_str(uint32 role) {
+   switch(role) {
+  case ROLE_STANDALONE:
+ return STANDALONE;
+ break;
+  case ROLE_DOMAIN_MEMBER:
+ return DOMAIN_MEMBER;
+ break;
+  case ROLE_DOMAIN_BDC:
+ return DOMAIN_BDC;
+ break;
+  case ROLE_DOMAIN_PDC:
+ return DOMAIN_PDC;
+ break;
+   }
+
+   return Invalid role!\n;
+}
+
+char *cactime_str(CacTime ctime, fstring tmp) {
+
+   snprintf(tmp, sizeof(fstring), %u Days, %u Hours, %u Minutes

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

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

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=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.h2005-08-24 02:11:47 UTC 
(rev 9559)
+++ branches/SOC/SAMBA_3_0/source/include/libmsrpc.h2005-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

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

2005-08-22 Thread skel
Author: skel
Date: 2005-08-22 19:43:47 + (Mon, 22 Aug 2005)
New Revision: 9485

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9485

Log:
added functions to get/set user info


Added:
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/samuser.c
Modified:
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
   branches/SOC/SAMBA_3_0/source/include/libmsrpc_internal.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc_internal.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/Makefile
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/test_util.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/test_util.h


Changeset:
Sorry, the patch is too large (715 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9485


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

2005-08-22 Thread skel
Author: skel
Date: 2005-08-22 22:06:48 + (Mon, 22 Aug 2005)
New Revision: 9489

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9489

Log:
added GetGroupInfo() SetGroupInfo() and RenameGroup()


Modified:
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
   branches/SOC/SAMBA_3_0/source/include/libmsrpc_internal.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc_internal.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/samgroup.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/samuser.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/test_util.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/test_util.h


Changeset:
Sorry, the patch is too large (615 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9489


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

2005-08-22 Thread skel
Author: skel
Date: 2005-08-23 02:40:27 + (Tue, 23 Aug 2005)
New Revision: 9502

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9502

Log:
added get/set alias info functions


Modified:
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
   branches/SOC/SAMBA_3_0/source/include/libmsrpc_internal.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc_internal.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/samuser.c


Changeset:
Sorry, the patch is too large (265 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9502


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

2005-08-21 Thread skel
Author: skel
Date: 2005-08-21 22:48:13 + (Sun, 21 Aug 2005)
New Revision: 9458

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9458

Log:
fixed cac_SamEnableUser() - was calling cli_samr_set_userinfo() with 
switch_value = 10, when it should have been 0x10

added cac_SamDisableUser() and cac_SamSetPassword()


Added:
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/disable.c
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:
Sorry, the patch is too large (268 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9458


svn commit: samba r9468 - in branches/SOC/SAMBA_3_0/source: include libmsrpc rpcclient

2005-08-21 Thread skel
Author: skel
Date: 2005-08-22 03:33:18 + (Mon, 22 Aug 2005)
New Revision: 9468

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9468

Log:
added internal functions for working with SAM_USERINFO_CTR structures


Modified:
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
   branches/SOC/SAMBA_3_0/source/include/libmsrpc_internal.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc_internal.c
   branches/SOC/SAMBA_3_0/source/rpcclient/cmd_samr.c


Changeset:
Sorry, the patch is too large (307 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9468


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

2005-08-20 Thread skel
Author: skel
Date: 2005-08-20 22:50:13 + (Sat, 20 Aug 2005)
New Revision: 9436

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9436

Log:
added cac_SamEnableUser() - needs to be fixed


Added:
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/enable.c
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.h2005-08-20 22:47:53 UTC 
(rev 9435)
+++ branches/SOC/SAMBA_3_0/source/include/libmsrpc.h2005-08-20 22:50:13 UTC 
(rev 9436)
@@ -1570,6 +1570,24 @@
 int cac_SamSetAliasMembers(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct 
SamSetAliasMembers *op);
 
 
+struct SamUserChangePasswd {
+   struct {
+  /**The username*/
+  char *username;
+
+  /**The current password*/
+  char *password;
+
+  /**The new password*/
+  char *new_password;
+   } in;
+};
+/**Used by a user to change their password*/
+int cac_SamUserChangePasswd(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct 
SamUserChangePasswd *op);
+
+/*Enables a user*/
+int cac_SamEnableUser(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND 
*user_hnd);
+
 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-20 22:47:53 UTC 
(rev 9435)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c   2005-08-20 22:50:13 UTC 
(rev 9436)
@@ -1451,3 +1451,103 @@
 
 }
 
+int cac_SamUserChangePasswd(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct 
SamUserChangePasswd *op) {
+   SMBCSRV *srv = NULL;
+
+   if(!hnd) 
+  return CAC_FAILURE;
+
+   if(!hnd-_internal.ctx) {
+  hnd-status = NT_STATUS_INVALID_HANDLE;
+  return CAC_FAILURE;
+   }
+
+   if(!op || !op-in.username || !op-in.password || !op-in.new_password || 
!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;
+   }
+
+   /*open a session on SAMR if we don't have one*/
+   if(!hnd-_internal.pipes[PI_SAMR]) {
+  if(!cli_nt_session_open(srv-cli, PI_SAMR)) {
+ hnd-status = NT_STATUS_UNSUCCESSFUL;
+ return CAC_FAILURE;
+  }
+
+  hnd-_internal.pipes[PI_SAMR] = True;
+   }
+
+   srv-cli.pipe_idx = PI_SAMR;
+
+   hnd-status = cli_samr_chgpasswd_user((srv-cli), mem_ctx, 
op-in.username, op-in.new_password, op-in.password);
+
+   if(!NT_STATUS_IS_OK(hnd-status))
+  return CAC_FAILURE;
+
+   return CAC_SUCCESS;
+}
+
+int cac_SamEnableUser(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND 
*user_hnd) {
+   SMBCSRV *srv = NULL;
+
+   SAM_USERINFO_CTR *get_ctr;
+   SAM_USERINFO_CTR set_ctr;
+   SAM_USER_INFO_10 info10;
+   uint32 acb_mask = 0;
+
+   if(!hnd) 
+  return CAC_FAILURE;
+
+   if(!hnd-_internal.ctx || !hnd-_internal.pipes[PI_SAMR]) {
+  hnd-status = NT_STATUS_INVALID_HANDLE;
+  return CAC_FAILURE;
+   }
+
+   if(!user_hnd || !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;
+
+   /*info_level = 21 is the only level that I have found to work reliably. It 
would be nice if user_level = 10 worked.*/
+   hnd-status = cli_samr_query_userinfo( (srv-cli), mem_ctx, user_hnd, 21, 
get_ctr);
+
+   if(!NT_STATUS_IS_OK(hnd-status))
+  return CAC_FAILURE;
+
+   /**check the ACB mask*/
+   if((get_ctr-info.id21-acb_info  ACB_DISABLED) == ACB_DISABLED) {
+  /*toggle the disabled bit*/
+  acb_mask = (get_ctr-info.id21-acb_info ^ ACB_DISABLED);
+   }
+   else {
+  /*the user is already enabled so just return success*/
+  return CAC_SUCCESS;
+   }
+
+   init_sam_user_info10(info10, acb_mask);
+
+   set_ctr.switch_value = 10;
+   set_ctr.info.id10 = info10;
+
+   /*now set the userinfo*/
+   hnd-status = cli_samr_set_userinfo( (srv-cli), mem_ctx, user_hnd, 10, 
(srv-cli.user_session_key), set_ctr);
+
+   if(!NT_STATUS_IS_OK(hnd-status))
+  return CAC_FAILURE;
+
+   return CAC_SUCCESS;
+}

Modified: branches/SOC/SAMBA_3_0/source/libmsrpc/test/Makefile
===
--- branches/SOC/SAMBA_3_0/source/libmsrpc/test/Makefile2005-08-20 
22:47:53 UTC (rev 9435)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/test/Makefile2005-08-20 
22:50:13 UTC (rev 9436)
@@ -82,5 +82,8 @@
 samalias: sam/samalias.o test_util.o

svn commit: samba r9395 - in branches/SOC/SAMBA_3_0/source: . include libmsrpc libmsrpc/test libmsrpc/test/sam

2005-08-18 Thread skel
Author: skel
Date: 2005-08-18 20:36:13 + (Thu, 18 Aug 2005)
New Revision: 9395

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9395

Log:
fixed infinite loop in cac_SamEnumGroups() if there are no groups in the sam

adduser can be used to delete a user that already exists


Modified:
   branches/SOC/SAMBA_3_0/source/Makefile.in
   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
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/adduser.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/samgroup.c


Changeset:
Modified: branches/SOC/SAMBA_3_0/source/Makefile.in
===
--- branches/SOC/SAMBA_3_0/source/Makefile.in   2005-08-18 16:41:27 UTC (rev 
9394)
+++ branches/SOC/SAMBA_3_0/source/Makefile.in   2005-08-18 20:36:13 UTC (rev 
9395)
@@ -137,7 +137,7 @@
 EVERYTHING_PROGS = bin/[EMAIL PROTECTED]@ bin/[EMAIL PROTECTED]@ bin/[EMAIL 
PROTECTED]@ \
bin/[EMAIL PROTECTED]@
 
-SHLIBS = @SHLIB_PROGS@ @LIBSMBCLIENT@
+SHLIBS = @SHLIB_PROGS@ @LIBSMBCLIENT@ cac
 
 SCRIPTS = $(srcdir)/script/smbtar $(builddir)/script/findsmb
 

Modified: branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
===
--- branches/SOC/SAMBA_3_0/source/include/libmsrpc.h2005-08-18 16:41:27 UTC 
(rev 9394)
+++ branches/SOC/SAMBA_3_0/source/include/libmsrpc.h2005-08-18 20:36:13 UTC 
(rev 9395)
@@ -1429,6 +1429,8 @@
 
   /**Array storing the descriptions of all the groups returned*/
   char **descriptions;
+
+  BOOL done;
} out;
 };
 

Modified: branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c
===
--- branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c   2005-08-18 16:41:27 UTC 
(rev 9394)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c   2005-08-18 20:36:13 UTC 
(rev 9395)
@@ -788,6 +788,7 @@
 
srv-cli.pipe_idx = PI_SAMR;
 
+   printf(addgroupmember: adding rid 0x%x\n, op-in.rid);
hnd-status = cli_samr_add_groupmem( (srv-cli), mem_ctx, 
op-in.group_hnd, op-in.rid);
 
if(!NT_STATUS_IS_OK(hnd-status))
@@ -869,6 +870,7 @@
 
/*try to delete the users one by one*/
for(i = 0; i  num_mem  NT_STATUS_IS_OK(hnd-status); i++) {
+  printf(cleargroupmembers: removing user 0x%x\n, rid[i]);
   hnd-status = cli_samr_del_groupmem((srv-cli), mem_ctx, group_hnd, 
rid[i]);
}
 
@@ -922,6 +924,7 @@
 
 
for(i = 0; i  op-in.num_members  NT_STATUS_IS_OK(hnd-status); i++) {
+  printf(setgroupmembers: adding 0x%x\n, op-in.rids[i]);
   hnd-status = cli_samr_add_groupmem( (srv-cli), mem_ctx, 
op-in.group_hnd, op-in.rids[i]);
}
 
@@ -958,10 +961,8 @@
   return CAC_FAILURE;
}
 
-/* cli_samr_enum_dom_users returns NT_STATUS_OK and sets resume_idx to 0 
if all users have been enumerated, making it tricky to use in a loop
- *  If all users have been enumerated and the developer has not modified 
op between calls, then the following will be true*/
-   /*FIXME: is there a better solution?*/
-   if(op-out.resume_idx == 0  op-out.num_groups != 0  op-out.rids != 
NULL  op-out.names != NULL)
+   /*using this BOOL is the only reliable way to know that we are done*/
+   if(op-out.done == True) /*we return failure so the call will break out of 
a loop*/
   return CAC_FAILURE;
 
srv = cac_GetServer(hnd);
@@ -978,10 +979,14 @@
 acct_buf, num_groups_out);
 
 
-   /*if there are no more entries, the operation will return NT_STATUS_OK. 
-* We want to return failure if no results were returned*/
-   if(!NT_STATUS_IS_OK(hnd-status)  NT_STATUS_V(hnd-status) != 
NT_STATUS_V(STATUS_MORE_ENTRIES))
+   if(NT_STATUS_IS_OK(hnd-status)) {
+  op-out.done = True;
+   }
+   else if(NT_STATUS_V(hnd-status) != NT_STATUS_V(STATUS_MORE_ENTRIES)) {
+  /*if there are no more entries, the operation will return NT_STATUS_OK. 
+   * We want to return failure if no results were returned*/
   return CAC_FAILURE;
+   }
 
names_out = talloc_array(mem_ctx, char *, num_groups_out);
if(!names_out) {

Modified: branches/SOC/SAMBA_3_0/source/libmsrpc/test/Makefile
===
--- branches/SOC/SAMBA_3_0/source/libmsrpc/test/Makefile2005-08-18 
16:41:27 UTC (rev 9394)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/test/Makefile2005-08-18 
20:36:13 UTC (rev 9395)
@@ -79,5 +79,8 @@
 samgroup: sam/samgroup.o test_util.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $ test_util.o $(LIBS)
 
+samalias: sam/samalias.o test_util.o
+   $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $ test_util.o $(LIBS)
+
 clean:
rm -f $(TESTS) *.o lsa/*.o reg/*.o sam/*.o

Modified: branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/adduser.c

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

2005-08-17 Thread skel
Author: skel
Date: 2005-08-17 17:01:41 + (Wed, 17 Aug 2005)
New Revision: 9367

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9367

Log:
added functions to remove/list/clear/set alias members


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


Changeset:
Modified: branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
===
--- branches/SOC/SAMBA_3_0/source/include/libmsrpc.h2005-08-17 15:23:52 UTC 
(rev 9366)
+++ branches/SOC/SAMBA_3_0/source/include/libmsrpc.h2005-08-17 17:01:41 UTC 
(rev 9367)
@@ -1516,6 +1516,58 @@
 
 int cac_SamAddAliasMember(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct 
SamAddAliasMember *op);
 
+struct SamRemoveAliasMember {
+   struct {
+  /**Open handle to the alias*/
+  POLICY_HND *alias_hnd;
+
+  /**The SID of the member*/
+  DOM_SID *sid;
+   } in;
+};
+
+int cac_SamRemoveAliasMember(CacServerHandle *hnd, TALLOC_CTX *mem_Ctx, struct 
SamRemoveAliasMember *op);
+
+struct SamGetAliasMembers {
+   struct {
+  /**Open handle to the alias*/
+  POLICY_HND *alias_hnd;
+   } in;
+
+   struct {
+  /**The number of members*/
+  uint32 num_members;
+
+  /**An array storing the SIDs of the users*/
+  DOM_SID *sids;
+   } out;
+};
+
+int cac_SamGetAliasMembers(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct 
SamGetAliasMembers *op);
+
+/[EMAIL PROTECTED] SAM_Functions
+ * Removes all the members of an alias  - warning: if this function fails is 
is possible that some but not all members were removed
+ */
+int cac_SamClearAliasMembers(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, 
POLICY_HND *alias_hnd);
+
+struct SamSetAliasMembers {
+   struct {
+  /**Open handle to the group*/
+  POLICY_HND *alias_hnd;
+
+  /**Number of members in the group - if this is 0, all members of the 
group will be removed*/
+  uint32 num_members;
+
+  /**The SIDs of the accounts to add*/
+  DOM_SID *sids;
+   } in;
+};
+
+/[EMAIL PROTECTED] SAM_Functions
+ * Removes all the users from an alias and adds a list of members to the 
alias*/
+int cac_SamSetAliasMembers(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct 
SamSetAliasMembers *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-17 15:23:52 UTC 
(rev 9366)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c   2005-08-17 17:01:41 UTC 
(rev 9367)
@@ -1274,3 +1274,175 @@
return CAC_SUCCESS;
 }
 
+int cac_SamRemoveAliasMember(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct 
SamRemoveAliasMember *op) {
+   SMBCSRV *srv = NULL;
+
+   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 || !op-in.alias_hnd || !op-in.sid || !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;
+
+   hnd-status = cli_samr_del_aliasmem( (srv-cli), mem_ctx, 
op-in.alias_hnd, op-in.sid);
+
+   if(!NT_STATUS_IS_OK(hnd-status))
+  return CAC_FAILURE;
+
+   return CAC_SUCCESS;
+}
+
+int cac_SamGetAliasMembers(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct 
SamGetAliasMembers *op) {
+   SMBCSRV *srv = NULL;
+
+   uint32 num_mem_out;
+   DOM_SID *sids_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 || !op-in.alias_hnd || !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;
+
+   hnd-status = cli_samr_query_aliasmem( (srv-cli), mem_ctx, 
op-in.alias_hnd, num_mem_out, sids_out);
+
+   if(!NT_STATUS_IS_OK(hnd-status))
+  return CAC_FAILURE;
+
+   op-out.num_members = num_mem_out;
+   op-out.sids= sids_out;
+
+   return CAC_SUCCESS;
+}
+
+int cac_SamClearAliasMembers(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, 
POLICY_HND *alias_hnd) {
+   SMBCSRV *srv = NULL;
+
+   int result = CAC_SUCCESS;
+
+   uint32 i = 0;
+
+   uint32 num_mem = 0;
+   DOM_SID *sid   = NULL;
+
+   NTSTATUS status;
+
+   if(!hnd) 
+  return CAC_FAILURE;
+
+   if(!hnd-_internal.ctx || !hnd-_internal.pipes[PI_SAMR]) {
+  hnd-status = NT_STATUS_INVALID_HANDLE;
+  return CAC_FAILURE;
+   }
+
+   if(!alias_hnd

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

2005-08-16 Thread skel
Author: skel
Date: 2005-08-16 22:22:29 + (Tue, 16 Aug 2005)
New Revision: 9333

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9333

Log:
modified cac_SamGetNamesFromRids() to use a struct cac_LookupRidsRecord instead 
of 3 arrays.
added cac_SamGetRidsFromNames()


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/sam/samgroup.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/samlookup.c


Changeset:
Sorry, the patch is too large (377 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9333


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

2005-08-16 Thread skel
Author: skel
Date: 2005-08-17 02:46:10 + (Wed, 17 Aug 2005)
New Revision: 9343

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9343

Log:
added EnumAliases() and some tests


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/sam/samenum.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/samgroup.c


Changeset:
Sorry, the patch is too large (359 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9343


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

2005-08-16 Thread skel
Author: skel
Date: 2005-08-17 03:48:41 + (Wed, 17 Aug 2005)
New Revision: 9348

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9348

Log:
added cac_SamCreateAlias(), cac_SamOpenAlias(), cac_SamDeleteAlias(), 
cac_SamAddAliasMember()


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


Changeset:
Modified: branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
===
--- branches/SOC/SAMBA_3_0/source/include/libmsrpc.h2005-08-17 03:30:45 UTC 
(rev 9347)
+++ branches/SOC/SAMBA_3_0/source/include/libmsrpc.h2005-08-17 03:48:41 UTC 
(rev 9348)
@@ -1463,7 +1463,59 @@
 
 int cac_SamEnumAliases(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct 
SamEnumAliases *op);
 
+struct SamCreateAlias {
+   struct {
+  /**Open handle to the domain SAM*/
+  POLICY_HND *domain;
 
+  /**The name of the alias*/
+  char *name;
+   } in;
+
+   struct {
+  /**Handle to the group*/
+  POLICY_HND *alias_hnd;
+   } out;
+};
+
+/** @ingroup SAM_Functions
+ * Creates an alias. If the alias already exists it will not be opened*/
+int cac_SamCreateAlias(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct 
SamCreateAlias *op);
+
+struct SamOpenAlias {
+   struct {
+  /**Open handle to the domain SAM*/
+  POLICY_HND *domain;
+
+  /**Desired access to open the group with. See Generic access masks in 
include/smb.h*/
+  uint32 access;
+
+  /**rid of the alias*/
+  uint32 alias_rid;
+   } in;
+
+   struct {
+  /**Handle to the alias*/
+  POLICY_HND *alias_hnd;
+   } out;
+};
+
+int cac_SamOpenAlias(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct 
SamOpenAlias *op);
+
+int cac_SamDeleteAlias(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND 
*alias_hnd);
+
+struct SamAddAliasMember {
+   struct {
+  /**Open handle to a alias*/
+  POLICY_HND *alias_hnd;
+
+  /**SID of new member*/
+  DOM_SID *sid;
+   } in;
+};
+
+int cac_SamAddAliasMember(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct 
SamAddAliasMember *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-17 03:30:45 UTC 
(rev 9347)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c   2005-08-17 03:48:41 UTC 
(rev 9348)
@@ -1124,3 +1124,153 @@
return CAC_SUCCESS;
 }
 
+int cac_SamCreateAlias(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct 
SamCreateAlias *op) {
+   SMBCSRV *srv = NULL;
+
+   POLICY_HND *als_hnd_out = NULL;
+
+   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 || !op-in.name || op-in.name[0] == '\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;
+
+   als_hnd_out = talloc(mem_ctx, POLICY_HND);
+   if(!als_hnd_out) {
+  hnd-status = NT_STATUS_NO_MEMORY;
+  return CAC_FAILURE;
+   }
+
+   hnd-status = cli_samr_create_dom_alias( (srv-cli), mem_ctx, 
op-in.domain, op-in.name, als_hnd_out);
+
+   if(!NT_STATUS_IS_OK(hnd-status))
+  return CAC_FAILURE;
+
+   op-out.alias_hnd = als_hnd_out;
+
+   return CAC_SUCCESS;
+
+}
+
+int cac_SamOpenAlias(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct 
SamOpenAlias *op) {
+   SMBCSRV *srv = NULL;
+
+   POLICY_HND *als_hnd_out = NULL;
+
+   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 || op-in.access == 0 || op-in.alias_rid == 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;
+
+   als_hnd_out = talloc(mem_ctx, POLICY_HND);
+   if(!als_hnd_out) {
+  hnd-status = NT_STATUS_NO_MEMORY;
+  return CAC_FAILURE;
+   }
+
+   hnd-status = cli_samr_open_alias( (srv-cli), mem_ctx, op-in.domain, 
op-in.access, op-in.alias_rid, als_hnd_out);
+
+   if(!NT_STATUS_IS_OK(hnd-status))
+  return CAC_FAILURE;
+
+   op-out.alias_hnd = als_hnd_out;
+
+   return CAC_SUCCESS;
+}
+
+int cac_SamDeleteAlias(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND 
*alias_hnd) {
+   SMBCSRV *srv = NULL;
+
+   if(!hnd) 
+  return CAC_FAILURE;
+
+   if(!hnd-_internal.ctx || !hnd-_internal.pipes[PI_SAMR]) {
+  hnd-status

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

2005-08-15 Thread skel
Author: skel
Date: 2005-08-15 23:05:15 + (Mon, 15 Aug 2005)
New Revision: 9308

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9308

Log:
added cac_SamAddGroupMember() and cac_SamRemoveGroupMember(). 
Fixed cac_GetGroupMembers() so it actually compiles now.

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


Changeset:
Sorry, the patch is too large (429 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9308


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

2005-08-15 Thread skel
Author: skel
Date: 2005-08-16 01:40:48 + (Tue, 16 Aug 2005)
New Revision: 9312

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9312

Log:
added functions to add/remove/clear/set group members (untested)


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


Changeset:
Sorry, the patch is too large (341 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9312


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

2005-08-15 Thread skel
Author: skel
Date: 2005-08-16 04:05:24 + (Tue, 16 Aug 2005)
New Revision: 9315

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9315

Log:
added samgroup which test the group functions.

modifed cac_SamClearGroupMembers() to take a POLICY_HND directly.


Added:
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/samgroup.c
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
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/samenum.c


Changeset:
Sorry, the patch is too large (537 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9315


svn commit: samba r9241 - in branches/SOC/SAMBA_3_0/source: . include libmsrpc

2005-08-11 Thread skel
Author: skel
Date: 2005-08-11 18:23:01 + (Thu, 11 Aug 2005)
New Revision: 9241

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9241

Log:
added SamConnect() SamOpenDomain() SamOpenDomainUser() and SamCreateDomainUser()


Added:
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c
Modified:
   branches/SOC/SAMBA_3_0/source/Makefile.in
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
   branches/SOC/SAMBA_3_0/source/include/libmsrpc_internal.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_lsarpc.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc_internal.c


Changeset:
Sorry, the patch is too large (505 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9241


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

2005-08-11 Thread skel
Author: skel
Date: 2005-08-11 22:59:02 + (Thu, 11 Aug 2005)
New Revision: 9248

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9248

Log:
added SamDeleteUser() and SamEnumUsers(), and a couple tests: adduser and enum 
users


Added:
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/adduser.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/samenum.c
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
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/test_util.c


Changeset:
Sorry, the patch is too large (403 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9248


svn commit: samba r9231 - in branches/SOC/SAMBA_3_0/source: include libmsrpc libmsrpc/test libmsrpc/test/lsa libmsrpc/test/reg

2005-08-10 Thread skel
Author: skel
Date: 2005-08-10 20:33:23 + (Wed, 10 Aug 2005)
New Revision: 9231

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9231

Log:
added cac_RegGetKeySecurity(), cac_RegSetKeySecurity(), cac_RegSaveKey() and 
cleaned up test directory

Added:
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/lsa/
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/lsa/ear.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/lsa/lsaenum.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/lsa/lsaenumprivs.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/lsa/lsapol.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/lsa/lsaq.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/lsa/lsatrust.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/reg/
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/reg/regdelete.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/reg/regkey.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/reg/regkeycreate.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/reg/regkeyenum.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/reg/regopen.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/reg/regopenkey.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/reg/regqueryval.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/reg/regsetval.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/reg/regvalenum.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/reg/shutdown.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/regdelete.c
Removed:
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/ear.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/lsaaddrights.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/lsaenum.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/lsaenumprivs.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/lsapol.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/lsaq.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/regkey.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/regkeycreate.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/regkeyenum.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/regopenkey.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/regqueryval.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/regsetval.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/regvalenum.c
Modified:
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_winreg.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/Makefile


Changeset:
Sorry, the patch is too large (4042 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9231


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

2005-08-10 Thread skel
Author: skel
Date: 2005-08-10 23:38:10 + (Wed, 10 Aug 2005)
New Revision: 9236

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9236

Log:
added (optional) recursive support to cac_RegDeleteKey()


Added:
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/reg/security.c
Modified:
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_winreg.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/Makefile
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/reg/regdelete.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/reg/regkeyenum.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/reg/shutdown.c


Changeset:
Sorry, the patch is too large (578 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9236


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

2005-08-08 Thread skel
Author: skel
Date: 2005-08-08 16:22:40 + (Mon, 08 Aug 2005)
New Revision: 9214

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9214

Log:
added cac_RegQueryValue()


Modified:
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
   branches/SOC/SAMBA_3_0/source/include/libmsrpc_internal.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_winreg.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc_internal.c


Changeset:
Sorry, the patch is too large (433 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9214


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

2005-08-08 Thread skel
Author: skel
Date: 2005-08-08 20:15:22 + (Mon, 08 Aug 2005)
New Revision: 9215

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9215

Log:
added cac_RegQueryValues()


Added:
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/reg_util.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/regvalenum.c
Modified:
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_winreg.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc_internal.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/Makefile


Changeset:
Sorry, the patch is too large (542 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9215


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

2005-08-08 Thread skel
Author: skel
Date: 2005-08-08 22:14:37 + (Mon, 08 Aug 2005)
New Revision: 9216

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9216

Log:
added cac_RegQueryKeyInfo(), cac_RegSetValue(), cac_Shutdown(), 
cac_AbortShutdown()


Modified:
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_winreg.c


Changeset:
Sorry, the patch is too large (323 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9216


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

2005-08-07 Thread skel
Author: skel
Date: 2005-08-08 01:10:46 + (Mon, 08 Aug 2005)
New Revision: 9206

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9206

Log:
added cac_RegDeleteKey() cac_RegDeleteValue() and cac_RegCreateKey()


Added:
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/regkeycreate.c
Modified:
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_winreg.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/Makefile
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/lsapol.c


Changeset:
Sorry, the patch is too large (420 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9206


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

2005-08-05 Thread skel
Author: skel
Date: 2005-08-05 20:08:17 + (Fri, 05 Aug 2005)
New Revision: 9138

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9138

Log:
added cac_RegConnect() cac_RegClose() and initial cac_RegOpenKey(), along with 
a simple test program


Added:
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_winreg.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/regkey.c
Modified:
   branches/SOC/SAMBA_3_0/source/Makefile.in
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/Makefile


Changeset:
Sorry, the patch is too large (349 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9138


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

2005-08-05 Thread skel
Author: skel
Date: 2005-08-05 22:51:29 + (Fri, 05 Aug 2005)
New Revision: 9144

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9144

Log:
added support for cac_RegOpenKey() to connect to the registry, for example you 
can call cac_regOpenKey() with a key name like HKEY_LOCAL_MACHINE\hardware 
and it will 
connect to the registry and open that key (also works with acronyms like HKCR)
added a program to test/demonstrate this


Added:
   branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc_internal.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/regopenkey.c
Modified:
   branches/SOC/SAMBA_3_0/source/Makefile.in
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
   branches/SOC/SAMBA_3_0/source/include/libmsrpc_internal.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_winreg.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/Makefile


Changeset:
Sorry, the patch is too large (306 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9144


svn commit: samba r9147 - in branches/SOC/SAMBA_3_0/source/libmsrpc: . test

2005-08-05 Thread skel
Author: skel
Date: 2005-08-05 23:08:13 + (Fri, 05 Aug 2005)
New Revision: 9147

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9147

Log:
changed cac_RegOpenKey() to call cac_RegConnect() instead of cli_reg_connect(). 
This is needed since cac_RegConnect() handles the housekeeping for the pipe 
session


Modified:
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_winreg.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/regopenkey.c


Changeset:
Modified: branches/SOC/SAMBA_3_0/source/libmsrpc/cac_winreg.c
===
--- branches/SOC/SAMBA_3_0/source/libmsrpc/cac_winreg.c 2005-08-05 23:01:57 UTC 
(rev 9146)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/cac_winreg.c 2005-08-05 23:08:13 UTC 
(rev 9147)
@@ -116,10 +116,12 @@
char *key_name = NULL;
uint32 reg_type = 0;
 
+   struct RegConnect rc;
+
if(!hnd) 
   return CAC_FAILURE;
 
-   if(!hnd-_internal.ctx || !hnd-_internal.pipes[PI_WINREG]) {
+   if(!hnd-_internal.ctx) {
   hnd-status = NT_STATUS_INVALID_HANDLE;
   return CAC_FAILURE;
}
@@ -135,7 +137,6 @@
   return CAC_FAILURE;
}
 
-   srv-cli.pipe_idx = PI_WINREG;
 
key_out = talloc(mem_ctx, POLICY_HND);
if(!key_out) {
@@ -150,30 +151,31 @@
  return CAC_FAILURE;
   }
 
-  parent_key = talloc(mem_ctx, POLICY_HND);
-  if(!parent_key) {
- hnd-status = NT_STATUS_NO_MEMORY;
- return CAC_FAILURE;
-  }
+  /*use cac_RegConnect because it handles the session setup*/
+  ZERO_STRUCT(rc);
 
-  err = cli_reg_connect( (srv-cli), mem_ctx, reg_type, op-in.access, 
parent_key);
-  hnd-status = werror_to_ntstatus(err);
+  rc.in.access = op-in.access;
+  rc.in.root   = reg_type;
 
-  if(!NT_STATUS_IS_OK(hnd-status)) {
+  if(!cac_RegConnect(hnd, mem_ctx, rc)) {
  return CAC_FAILURE;
   }
 
   /**if they only specified the root key, return the key we just opened*/
   if(key_name == NULL) {
- op-out.key = parent_key;
+ op-out.key = rc.out.key;
  return CAC_SUCCESS;
   }
+
+  parent_key = rc.out.key;
}
else {
   parent_key  = op-in.parent_key;
   key_name= op-in.key_name;
}
 
+   srv-cli.pipe_idx = PI_WINREG;
+
err = cli_reg_open_entry( (srv-cli), mem_ctx, parent_key, key_name, 
op-in.access, key_out);
hnd-status = werror_to_ntstatus(err);
 

Modified: branches/SOC/SAMBA_3_0/source/libmsrpc/test/regopenkey.c
===
--- branches/SOC/SAMBA_3_0/source/libmsrpc/test/regopenkey.c2005-08-05 
23:01:57 UTC (rev 9146)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/test/regopenkey.c2005-08-05 
23:08:13 UTC (rev 9147)
@@ -56,19 +56,6 @@
exit(-1);
 }
 
-struct RegConnect rc;
-ZERO_STRUCT(rc);
-
-rc.in.access = REG_KEY_ALL;
-rc.in.root   = HKEY_LOCAL_MACHINE;
-
-if(!cac_RegConnect(hnd, mem_ctx, rc)) {
-   fprintf(stderr,  Could not connect to registry. %s\n, 
nt_errstr(hnd-status));
-   goto done;
-}
-
-
-
 for(i = 0; i  num_keys; i++) {
printf(trying to open key %s...\n, key_names[i]);
 
@@ -91,10 +78,6 @@
}
 }
 
-if(!cac_RegClose(hnd, mem_ctx, rc.out.key)) {
-   fprintf(stderr,  Could not close handle. %s\n, 
nt_errstr(hnd-status));
-}
-
 done:
 cac_FreeHandle(hnd);
 



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

2005-08-05 Thread skel
Author: skel
Date: 2005-08-06 01:08:31 + (Sat, 06 Aug 2005)
New Revision: 9158

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9158

Log:
added cac_RegEnumKeys()

Added:
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/regkeyenum.c
Modified:
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_winreg.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/Makefile


Changeset:
Sorry, the patch is too large (298 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9158


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

2005-08-04 Thread skel
Author: skel
Date: 2005-08-04 07:27:25 + (Thu, 04 Aug 2005)
New Revision: 9056

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9056

Log:
added functions to manipulate privileges (lsa) and some test programs.
added privlege constants and info class constsants (which need to be fixed)


Added:
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/ear.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/lsaaddrights.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/lsaenumprivs.c
Modified:
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_lsarpc.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/Makefile


Changeset:
Sorry, the patch is too large (1194 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9056


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

2005-08-04 Thread skel
Author: skel
Date: 2005-08-04 21:20:53 + (Thu, 04 Aug 2005)
New Revision: 9075

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9075

Log:
organized the CacServerHandle, added cac_GetServer function to get a SMBCSRV* 
and took it out of the server handle, fixed up info class constants

Modified:
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
   branches/SOC/SAMBA_3_0/source/include/libmsrpc_internal.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_lsarpc.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc.c


Changeset:
Sorry, the patch is too large (647 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9075


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

2005-08-02 Thread skel
Author: skel
Date: 2005-08-02 18:25:19 + (Tue, 02 Aug 2005)
New Revision: 8931

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=8931

Log:
added cac_LsaQueryInfoPolicy(), cac_LsaEnumSids(), 
cac_LsaEnumAcctRightsFromSid() and a new test/demo program (lsaenum)
modified get_auth_data_fn slightly and added to libmsrpc.c


Added:
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/lsaenum.c
Modified:
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_lsarpc.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/Makefile
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/lsaq.c


Changeset:
Sorry, the patch is too large (536 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=8931


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

2005-08-02 Thread skel
Author: skel
Date: 2005-08-02 20:37:52 + (Tue, 02 Aug 2005)
New Revision: 8945

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=8945

Log:
added cac_LsaEnumTrustedDomains() cac_LsaOpenTrustedDomain(), 
cac_LsaQueryTrustedDomainInfo(). they haven't been tested and I need to define 
some constants for the 
info_class parm of cacLsaQueryTrustedDomainInfo()

Modified:
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_lsarpc.c


Changeset:
Modified: branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
===
--- branches/SOC/SAMBA_3_0/source/include/libmsrpc.h2005-08-02 20:35:52 UTC 
(rev 8944)
+++ branches/SOC/SAMBA_3_0/source/include/libmsrpc.h2005-08-02 20:37:52 UTC 
(rev 8945)
@@ -409,10 +409,81 @@
  * @return  - CAC_FAILURE The operation was not successful, hnd-status is set 
appropriately
  *  - CAC_SUCCESS The operation completed successfully
  */
-int cac_LsaEnumAcctRightsFromSid(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, 
struct LsaEnumAccountRights *op);
+int cac_LsaEnumAccountRightsBySid(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, 
struct LsaEnumAccountRights *op);
 
+struct LsaEnumTrustedDomains {
+   struct {
+  /**Open LSA policy handle*/
+  POLICY_HND *pol;
+   } in;
+
+   struct {
+  /**used to keep track of how many domains have been retrieved over 
multiple calls
+   *  should be set to zero via ZERO_STRUCT() before the first call. Use 
the same struct LsaEnumSids for multiple calls*/
+  uint32 resume_idx;
+  
+  /**The number of domains returned by the remote server this call*/
+  uint32 num_domains;
+
+  /**array of trusted domain names returned by the remote server*/
+  char **domain_names;
+
+  /**array of trusted domain sids returned by the remote server*/
+  DOM_SID *domain_sids;
+   } out;
+};
  
+int cac_LsaEnumTrustedDomains(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, 
struct LsaEnumTrustedDomains *op);
 
+struct LsaOpenTrustedDomain {
+   struct {
+  /**an open LSA policy handle*/
+  POLICY_HND *pol;
+
+  /**SID of the trusted domain to open*/
+  DOM_SID *domain_sid;
+
+  /**Desired access on the open domain*/
+  uint32 access;
+   } in;
+
+   struct {
+  /**A handle to the policy that is opened*/
+  POLICY_HND *domain_policy;
+   } out;
+};
+
+/** @ingroup LSA_Functions
+ * Opens a trusted domain by SID.
+ * @return  - CAC_FAILURE a handle to the domain could not be opened. 
hnd-status is set with approriate NT_STATUS code
+ *  - CAC_SUCCESS the domain was opened successfully
+ */
+int cac_LsaOpenTrustedDomain(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct 
LsaOpenTrustedDomain *op);
+
+struct LsaQueryTrustedDomainInfo {
+   struct {
+  /**Open LSA policy handle*/
+  POLICY_HND *pol;
+
+  /**Info class of returned data*/
+  uint16 info_class;
+
+  /**(Optional)SID of trusted domain to query (must specify either SID or 
name of trusted domain)*/
+  DOM_SID *domain_sid;
+
+  /**(Optional)Name of trusted domain to query (must specify either SID or 
name of trusted domain)*/
+  char *domain_name;
+   } in;
+
+   struct {
+  /**information about the trusted domain*/
+  LSA_TRUSTED_DOMAIN_INFO *info;
+   } out;
+};
+
+int cac_LsaQueryTrustedDomainInfo(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, 
struct LsaQueryTrustedDomainInfo *op);
+  
+
 void cac_GetAuthDataFn(const char * pServer,
  const char * pShare,
  char * pWorkgroup,

Modified: branches/SOC/SAMBA_3_0/source/libmsrpc/cac_lsarpc.c
===
--- branches/SOC/SAMBA_3_0/source/libmsrpc/cac_lsarpc.c 2005-08-02 20:35:52 UTC 
(rev 8944)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/cac_lsarpc.c 2005-08-02 20:37:52 UTC 
(rev 8945)
@@ -558,7 +558,8 @@
 
 }
 
-int cac_LsaEnumAccountRights(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct 
LsaEnumAccountRights *op) {
+/*TODO: make a cac_LsaEnumAccountRights() that will find the rights based on 
either a SID or a name*/
+int cac_LsaEnumAccountRightsBySid(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, 
struct LsaEnumAccountRights *op) {
SMBCSRV *srv = NULL;
 
uint32 count = 0;
@@ -599,3 +600,120 @@
return CAC_SUCCESS;

 }
+
+int cac_LsaEnumTrustedDomains(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, 
struct LsaEnumTrustedDomains *op) {
+   SMBCSRV *srv;
+   
+   uint32 num_domains;
+   char **domain_names;
+   DOM_SID *domain_sids;
+   
+   if(!hnd)
+  return CAC_FAILURE;
+
+   if(!hnd-ctx || !hnd-_pipes[PI_LSARPC]) {
+  hnd-status = NT_STATUS_INVALID_HANDLE;
+  return CAC_FAILURE;
+   }
+
+   if(!op-in.pol) {
+  hnd-status = NT_STATUS_INVALID_PARAMETER;
+  return CAC_FAILURE;
+   }
+
+   if(!cac_Connect(hnd, NULL)) {
+  return CAC_FAILURE;
+   }
+
+   srv = hnd-srv;
+   srv-cli.pipe_idx

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

2005-08-01 Thread skel
Author: skel
Date: 2005-08-02 03:26:27 + (Tue, 02 Aug 2005)
New Revision: 8907

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=8907

Log:
fixed error checking in library (now returns useful errors via hnd-status)
added cac_LsaFetchSid()
added a test/example program for lsa functions
fixed some minor bugs



Added:
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/lsaq.c
Modified:
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_lsarpc.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/Makefile
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/lsapol.c


Changeset:
Sorry, the patch is too large (780 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=8907


svn commit: samba r8877 - in branches/SOC/SAMBA_3_0/source: . include libmsrpc libmsrpc/test libsmb

2005-07-31 Thread skel
Author: skel
Date: 2005-08-01 01:29:36 + (Mon, 01 Aug 2005)
New Revision: 8877

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=8877

Log:
changed to using a libsmbclient structure in CacServerHandle instead of 
cli_state* structureo. ended up having to #include includes.h in libmsrpc. 
move TALLOC_CTX out of CacServerHandle

added very simple test/example code for libmsrpc (found in libmsrpc/test)

modified smbc_attr_server() to not open an LSA policy handle if the *pol 
parameter is NULL. 

some code cleanups (BOOL instead of ints, define some constants etc)


Added:
   branches/SOC/SAMBA_3_0/source/include/libmsrpc_internal.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/Makefile
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/README
   branches/SOC/SAMBA_3_0/source/libmsrpc/test/lsapol.c
Modified:
   branches/SOC/SAMBA_3_0/source/Makefile.in
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
   branches/SOC/SAMBA_3_0/source/include/rpc_includes.h
   branches/SOC/SAMBA_3_0/source/include/rpc_proto.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_lsarpc.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc.c
   branches/SOC/SAMBA_3_0/source/libsmb/libsmbclient.c


Changeset:
Sorry, the patch is too large (943 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=8877


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

2005-07-31 Thread skel
Author: skel
Date: 2005-08-01 04:16:20 + (Mon, 01 Aug 2005)
New Revision: 8881

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=8881

Log:
added cac_LsaGetNamesFromSids() and cac_LsaGetSidsFromNames(). They have not 
yet been tested.


Modified:
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_lsarpc.c


Changeset:
Sorry, the patch is too large (319 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=8881


svn commit: samba r8785 - in branches/SOC/SAMBA_3_0/source: . include libmsrpc

2005-07-26 Thread skel
Author: skel
Date: 2005-07-26 18:48:36 + (Tue, 26 Jul 2005)
New Revision: 8785

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=8785

Log:
added some functions for the lsa pipe, and some additional members of 
CacServerHandle.  Added a few more objects for libmsrpc in Makefile.in 
(hopefully it's linking properly now)


Added:
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_lsarpc.c
Modified:
   branches/SOC/SAMBA_3_0/source/Makefile.in
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc.c


Changeset:
Sorry, the patch is too large (360 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=8785


svn commit: samba r8764 - in branches/SOC/SAMBA_3_0/source: . include libmsrpc

2005-07-25 Thread skel
Author: skel
Date: 2005-07-26 01:11:02 + (Tue, 26 Jul 2005)
New Revision: 8764

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=8764

Log:
added libmsrpc.c and libmsrpc.h, with simple functions to initialize a 
CacServerHandle and connect to a server.
moved  headers into include/

modified Makefile.in to add rules for libmsrpc, although I'm not sure if the 
shared object is currently linking properly


Added:
   branches/SOC/SAMBA_3_0/source/include/cac_inludes.h
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
   branches/SOC/SAMBA_3_0/source/include/rpc_includes.h
   branches/SOC/SAMBA_3_0/source/include/rpc_proto.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc.c
Removed:
   branches/SOC/SAMBA_3_0/source/libmsrpc/rpc_includes.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/rpc_proto.h
Modified:
   branches/SOC/SAMBA_3_0/source/Makefile.in


Changeset:
Sorry, the patch is too large (5711 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=8764


svn commit: samba r8208 - in branches/SOC/SAMBA_3_0/source: . libmsrpc

2005-07-07 Thread skel
Author: skel
Date: 2005-07-07 15:01:00 + (Thu, 07 Jul 2005)
New Revision: 8208

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=8208

Log:
Initial commit for libmsrpc.

Files used to identify the minimal set of dependant files to compile 
rpc_client/*.c.  This will be used as the framework for the libmsrpc library.

rpc_includes.h is a header needed to compile rpc_client/*.c with minimal 
dependencies.

rpc_proto.h contains function prototypes needed to complie rpc_client/*.c with 
minimal dependencies 
 -all prototypes copied from include/proto.h

Makefile.libmsrpc
 - used to test the dependant files needed to compile rpc_client/*.c
 - attempts to create a libmsrpc.o file which is all of rpc_client/*.c plus its 
dependencies compiled statically
 - won't actually create the object unless all of the dependencies for the 
depencies can be resolved
   - as long as no rpc_client/*.c files have undefined references then the 
dependencies are resolved 

presently, the rpc_client/*.c files are still including include/includes.h, 
however if rpc_includes.h is moved to include/ they will compile if they 
include rpc_includes.h instead




Added:
   branches/SOC/SAMBA_3_0/source/libmsrpc/
   branches/SOC/SAMBA_3_0/source/libmsrpc/Makefile.libmsrpc
   branches/SOC/SAMBA_3_0/source/libmsrpc/rpc_includes.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/rpc_proto.h


Changeset:
Sorry, the patch is too large (2720 lines) to include; please use WebSVN to see 
it!
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=8208