svn commit: samba r7199 - in trunk/source: include lib rpc_server

jerry at samba.org jerry at samba.org
Thu Jun 2 20:42:39 GMT 2005


Author: jerry
Date: 2005-06-02 20:42:38 +0000 (Thu, 02 Jun 2005)
New Revision: 7199

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

Log:
starting workon RegRestoreKey(); adding SeRestorePrivilege and SeTakeOwnershipPrivilege
Modified:
   trunk/source/include/privileges.h
   trunk/source/lib/privileges.c
   trunk/source/rpc_server/srv_reg_nt.c


Changeset:
Modified: trunk/source/include/privileges.h
===================================================================
--- trunk/source/include/privileges.h	2005-06-02 16:58:18 UTC (rev 7198)
+++ trunk/source/include/privileges.h	2005-06-02 20:42:38 UTC (rev 7199)
@@ -58,6 +58,8 @@
 #define SE_DISK_OPERATOR		{ { 0x00000080, 0x00000000, 0x00000000, 0x00000000 } }
 #define SE_REMOTE_SHUTDOWN		{ { 0x00000100, 0x00000000, 0x00000000, 0x00000000 } }
 #define SE_BACKUP			{ { 0x00000200, 0x00000000, 0x00000000, 0x00000000 } }
+#define SE_RESTORE			{ { 0x00000400, 0x00000000, 0x00000000, 0x00000000 } }
+#define SE_TAKE_OWNERSHIP		{ { 0x00000800, 0x00000000, 0x00000000, 0x00000000 } }
 
 /* defined in lib/privilegs.c */
 
@@ -67,6 +69,7 @@
 extern const SE_PRIV se_add_users;
 extern const SE_PRIV se_disk_operators;
 extern const SE_PRIV se_remote_shutdown;
+extern const SE_PRIV se_restore;
 
 
 /*

Modified: trunk/source/lib/privileges.c
===================================================================
--- trunk/source/lib/privileges.c	2005-06-02 16:58:18 UTC (rev 7198)
+++ trunk/source/lib/privileges.c	2005-06-02 20:42:38 UTC (rev 7199)
@@ -39,6 +39,7 @@
 const SE_PRIV se_add_users       = SE_ADD_USERS;
 const SE_PRIV se_disk_operators  = SE_DISK_OPERATOR;
 const SE_PRIV se_remote_shutdown = SE_REMOTE_SHUTDOWN;
+const SE_PRIV se_restore         = SE_RESTORE;
 
 /********************************************************************
  This is a list of privileges reported by a WIndows 2000 SP4 AD DC
@@ -92,6 +93,8 @@
 	{SE_REMOTE_SHUTDOWN,		"SeRemoteShutdownPrivilege",		"Force shutdown from a remote system"},
 	{SE_DISK_OPERATOR,		"SeDiskOperatorPrivilege",		"Manage disk shares"},
         {SE_BACKUP,                     "SeBackupPrivilege",                    "Back up files and directories"},
+        {SE_RESTORE,                    "SeRestorePrivilege",                   "Restore files and directories"},
+	{SE_TAKE_OWNERSHIP,             "SeTakeOwnershipPrivilege",             "Take ownership of files or other objects"},
 
 	{SE_END,			"",					""}
 };

Modified: trunk/source/rpc_server/srv_reg_nt.c
===================================================================
--- trunk/source/rpc_server/srv_reg_nt.c	2005-06-02 16:58:18 UTC (rev 7198)
+++ trunk/source/rpc_server/srv_reg_nt.c	2005-06-02 20:42:38 UTC (rev 7199)
@@ -765,6 +765,15 @@
 /*******************************************************************
  ********************************************************************/
 
+static WERROR restore_registry_key ( REGISTRY_KEY *krecord, const char *fname )
+{
+
+	return WERR_OK;
+}
+
+/*******************************************************************
+ ********************************************************************/
+
 WERROR _reg_restore_key(pipes_struct *p, REG_Q_RESTORE_KEY  *q_u, REG_R_RESTORE_KEY *r_u)
 {
 	REGISTRY_KEY	*regkey = find_regkey_index_by_hnd( p, &q_u->pol );
@@ -783,13 +792,14 @@
 	if ( (snum = validate_reg_filename( filename )) == -1 )
 		return WERR_OBJECT_PATH_INVALID;
 		
+	/* user must posses SeRestorePrivilege for this this proceed */
+	
+	if ( !user_has_privileges( p->pipe_user.nt_user_token, &se_restore ) )
+		return WERR_ACCESS_DENIED;
+		
 	DEBUG(2,("_reg_restore_key: Restoring [%s] from %s in share %s\n", regkey->name, filename, lp_servicename(snum) ));
 
-#if 0
 	return restore_registry_key( regkey, filename );
-#endif
-
-	return WERR_OK;
 }
 
 /********************************************************************



More information about the samba-cvs mailing list