devel-script: add options for RODC and partial replica for replicate flags
[sfrench/samba-autobuild/.git] / source4 / scripting / devel / getncchanges
index eac4de606354571ac74b121d46f479a89406cc46..37ec18b22481e62c476cfcbdceaa7bc315aba7f3 100755 (executable)
@@ -101,9 +101,13 @@ if __name__ == "__main__":
     parser.add_option("", "--dn", dest="dn", help="DN to replicate",)
     parser.add_option("", "--exop", dest="exop", help="extended operation",)
     parser.add_option("", "--pas", dest="use_pas", action='store_true', default=False,
-                      help="send partial attribute set",)
+                      help="send partial attribute set (for RODC)")
     parser.add_option("", "--nb-iter", type='int', help="Number of getncchange iterations")
     parser.add_option("", "--dest-dsa", type='str', help="destination DSA GUID")
+    parser.add_option("", "--rodc", action='store_true', default=False,
+                      help='use RODC replica flags')
+    parser.add_option("", "--partial-rw", action='store_true', default=False,
+                      help='use RW partial replica flags, not be confused with --pas')
     parser.add_option("", "--replica-flags", type='int',
                       default=drsuapi.DRSUAPI_DRS_INIT_SYNC |
                       drsuapi.DRSUAPI_DRS_PER_SYNC |
@@ -113,6 +117,19 @@ if __name__ == "__main__":
                       help='replica flags')
 
     (opts, args) = parser.parse_args()
+    if opts.rodc:
+        opts.replica_flags = drsuapi.DRSUAPI_DRS_INIT_SYNC |\
+                             drsuapi.DRSUAPI_DRS_PER_SYNC |\
+                             drsuapi.DRSUAPI_DRS_GET_ANC |\
+                             drsuapi.DRSUAPI_DRS_NEVER_SYNCED |\
+                             drsuapi.DRSUAPI_DRS_SPECIAL_SECRET_PROCESSING |\
+                             drsuapi.DRSUAPI_DRS_GET_ALL_GROUP_MEMBERSHIP
+
+    if opts.partial_rw:
+        opts.replica_flags = drsuapi.DRSUAPI_DRS_INIT_SYNC |\
+                             drsuapi.DRSUAPI_DRS_PER_SYNC |\
+                             drsuapi.DRSUAPI_DRS_GET_ANC |\
+                             drsuapi.DRSUAPI_DRS_NEVER_SYNCED
 
     lp = sambaopts.get_loadparm()
     creds = credopts.get_credentials(lp)
@@ -123,6 +140,9 @@ if __name__ == "__main__":
     if creds.is_anonymous():
         parser.error("You must supply credentials")
 
+    if opts.partial_rw and opts.rodc:
+        parser.error("Can't specify --partial-rw and --rodc")
+
     server = args[0]
 
     binding_str = "ncacn_ip_tcp:%s[seal,print]" % server