コード例 #1
0
        public DRS_MSG_REPSYNC CreateDrsReplicaSyncV2Request()
        {
            DRS_MSG_REPSYNC req = new DRS_MSG_REPSYNC();

            req.V2            = new DRS_MSG_REPSYNC_V2();
            req.V2.pNC        = DrsuapiClient.CreateDsName(null, Guid.Empty, null);
            req.V2.uuidDsaSrc = Guid.Empty;
            return(req);
        }
コード例 #2
0
        public void DRSR_DRSReplicaSync_No_Replica()
        {
            DrsrTestChecker.Check();
            uint ret = drsTestClient.DrsBind(
                EnvironmentConfig.Machine.WritableDC1,
                EnvironmentConfig.User.ParentDomainAdmin,
                DRS_EXTENSIONS_IN_FLAGS.DRS_EXT_BASE);
            /* comments from TD */

            /*
             * rf := select all v in nc!repsFrom
             * where DRS_SYNC_ALL in options
             * or (DRS_SYNC_BYNAME in options
             *  and v.naDsa = msgIn.pszDsaSrc)
             * or (not DRS_SYNC_BYNAME in options
             *  and v.uuidDsa = msgIn.uuidDsaSrc)
             * if rf = null then
             * return ERROR_DS_DRA_NO_REPLICA
             * endif
             *
             */


            /* Create request message */
            DRS_MSG_REPSYNC msgIn = drsTestClient.CreateDrsReplicaSyncV1Request();

            uint dwInVersion = 1;

            /* Setting param #1 */
            /*msgIn.V1.pszDsaSrc = "InvalidDsaSrc"*/
            msgIn.V1.pszDsaSrc = "InvalidDsaSrc";
            /* Setting param #2 */
            /*msgIn.V1.ulOptions = (uint)DRS_OPTIONS.DRS_SYNC_BYNAME*/
            msgIn.V1.ulOptions = (uint)DRS_OPTIONS.DRS_SYNC_BYNAME;

            // NC
            DsServer srv = (DsServer)EnvironmentConfig.MachineStore[EnvironmentConfig.Machine.WritableDC1];

            RootDSE rootDse  = LdapUtility.GetRootDSE(srv);
            DSNAME  ncDsname = LdapUtility.CreateDSNameForObject(srv, rootDse.defaultNamingContext);

            msgIn.V1.pNC = ncDsname;

            /* Issue the request */
            ret = drsTestClient.DRSClient.DrsReplicaSync(
                EnvironmentConfig.DrsContextStore[EnvironmentConfig.Machine.WritableDC1],
                dwInVersion,
                msgIn);
            BaseTestSite.Assert.AreEqual <uint>(
                (uint)Win32ErrorCode_32.ERROR_DS_DRA_NO_REPLICA,
                ret,
                "DrsReplicaSync: return code mismatch."
                );
        }
コード例 #3
0
        public void DRSR_DRSReplicaSync_Invalid_Input_2()
        {
            DrsrTestChecker.Check();
            uint ret = drsTestClient.DrsBind(
                EnvironmentConfig.Machine.WritableDC1,
                EnvironmentConfig.User.ParentDomainAdmin,
                DRS_EXTENSIONS_IN_FLAGS.DRS_EXT_BASE);
            /* comments from TD */

            /*
             * options := msgIn.ulOptions
             * if msgIn.pNC = null
             * or (not DRS_SYNC_ALL in options
             * and msgIn.uuidDsaSrc = null
             * and msgIn.pszDsaSrc = null) then
             * return ERROR_DS_DRA_INVALID_PARAMETER
             * endif
             *
             */


            /* Create request message */
            DRS_MSG_REPSYNC msgIn = drsTestClient.CreateDrsReplicaSyncV1Request();

            uint dwInVersion = 1;

            /* Setting param #1 */
            /*msgIn.V1.ulOptions = 0*/
            msgIn.V1.ulOptions = 0;
            /* Setting param #2 */
            /*msgIn.V1.uuidDsaSrc = Guid.Empty*/
            msgIn.V1.uuidDsaSrc = Guid.Empty;
            /* Setting param #3 */
            /*msgIn.V1.pszDsaSrc = null*/
            msgIn.V1.pszDsaSrc = null;
            // NC
            DsServer srv = (DsServer)EnvironmentConfig.MachineStore[EnvironmentConfig.Machine.WritableDC1];

            RootDSE rootDse  = LdapUtility.GetRootDSE(srv);
            DSNAME  ncDsname = LdapUtility.CreateDSNameForObject(srv, rootDse.configurationNamingContext);

            msgIn.V1.pNC = ncDsname;

            /* Issue the request */
            ret = drsTestClient.DRSClient.DrsReplicaSync(
                EnvironmentConfig.DrsContextStore[EnvironmentConfig.Machine.WritableDC1],
                dwInVersion,
                msgIn);
            BaseTestSite.Assert.AreEqual <uint>(
                (uint)Win32ErrorCode_32.ERROR_DS_DRA_INVALID_PARAMETER,
                ret,
                "DrsReplicaSync: return code mismatch."
                );
        }
コード例 #4
0
        public void DRSR_DRSReplicaSync_Access_Denied()
        {
            DrsrTestChecker.Check();
            uint ret = drsTestClient.DrsBind(
                EnvironmentConfig.Machine.WritableDC1,
                EnvironmentConfig.User.ParentDomainUser,
                DRS_EXTENSIONS_IN_FLAGS.DRS_EXT_BASE);
            /* comments from TD */

            /*
             * if AccessCheckCAR(nc, DS-Replication-Synchronize) then
             * return ERROR_DS_DRA_ACCESS_DENIED
             * endif
             *
             */

            /* comments from likezh */

            /*
             * !AccessCheckCAR(nc, DS-Replication-Synchronize)
             */
            //throw new NotImplementedException();

            /* Create request message */
            DRS_MSG_REPSYNC msgIn = drsTestClient.CreateDrsReplicaSyncV1Request();
            // NC
            DsServer srv = (DsServer)EnvironmentConfig.MachineStore[EnvironmentConfig.Machine.WritableDC1];

            RootDSE rootDse  = LdapUtility.GetRootDSE(srv);
            DSNAME  ncDsname = LdapUtility.CreateDSNameForObject(srv, rootDse.defaultNamingContext);

            msgIn.V1.pNC = ncDsname;

            // This API will check the uuidDsaSrc first to validate the input, so
            // to go thru that we set the uuidDsaSrc to any guid.
            msgIn.V1.uuidDsaSrc = DRSConstants.DrsRpcInterfaceGuid;

            uint dwInVersion = 1;

            /* Issue the request */
            ret = drsTestClient.DRSClient.DrsReplicaSync(
                EnvironmentConfig.DrsContextStore[EnvironmentConfig.Machine.WritableDC1],
                dwInVersion,
                msgIn);
            BaseTestSite.Assert.AreEqual <uint>(
                (uint)Win32ErrorCode_32.ERROR_DS_DRA_ACCESS_DENIED,
                ret,
                "DrsReplicaSync: return code mismatch."
                );
        }
コード例 #5
0
        private void DRSReplicaSync_Invalid_Input_1(DrsReplicaSync_Versions dwInVersion)
        {
            uint ret = drsTestClient.DrsBind(
                EnvironmentConfig.Machine.WritableDC1,
                EnvironmentConfig.User.ParentDomainAdmin,
                DRS_EXTENSIONS_IN_FLAGS.DRS_EXT_BASE);
            /* comments from TD */

            /*
             *  options := msgIn.ulOptions
             *  if msgIn.pNC = null
             *     or (not DRS_SYNC_ALL in options
             *         and msgIn.uuidDsaSrc = null
             *         and msgIn.pszDsaSrc = null) then
             *    return ERROR_DS_DRA_INVALID_PARAMETER
             *  endif
             */

            /* Create request message */
            DRS_MSG_REPSYNC msgIn = new DRS_MSG_REPSYNC();

            switch (dwInVersion)
            {
            case DrsReplicaSync_Versions.V1:
                msgIn = drsTestClient.CreateDrsReplicaSyncV1Request();
                /* Setting param #1 */
                //msgIn.V1.pNC = null;
                break;

            case DrsReplicaSync_Versions.V2:
                msgIn = drsTestClient.CreateDrsReplicaSyncV2Request();
                break;

            default:
                BaseTestSite.Assert.Fail("The version {0} is not supported.", dwInVersion);
                break;
            }

            /* Issue the request */
            ret = drsTestClient.DRSClient.DrsReplicaSync(
                EnvironmentConfig.DrsContextStore[EnvironmentConfig.Machine.WritableDC1],
                (uint)dwInVersion,
                msgIn);
            BaseTestSite.Assert.AreEqual <uint>(
                (uint)Win32ErrorCode_32.ERROR_DS_DRA_INVALID_PARAMETER,
                ret,
                "DrsReplicaSync: return code mismatch."
                );
        }
コード例 #6
0
        public void DRSR_DRSReplicaSync_Invalid_Input_1()
        {
            DrsrTestChecker.Check();
            uint ret = drsTestClient.DrsBind(
                EnvironmentConfig.Machine.WritableDC1,
                EnvironmentConfig.User.ParentDomainAdmin,
                DRS_EXTENSIONS_IN_FLAGS.DRS_EXT_BASE);
            /* comments from TD */

            /*
             * options := msgIn.ulOptions
             * if msgIn.pNC = null
             * or (not DRS_SYNC_ALL in options
             * and msgIn.uuidDsaSrc = null
             * and msgIn.pszDsaSrc = null) then
             * return ERROR_DS_DRA_INVALID_PARAMETER
             * endif
             *
             */


            /* Create request message */
            DRS_MSG_REPSYNC msgIn = drsTestClient.CreateDrsReplicaSyncV1Request();

            uint dwInVersion = 1;

            /* Setting param #1 */
            /*msgIn.V1.pNC = null*/
            //msgIn.V1.pNC = null;

            /* Issue the request */
            ret = drsTestClient.DRSClient.DrsReplicaSync(
                EnvironmentConfig.DrsContextStore[EnvironmentConfig.Machine.WritableDC1],
                dwInVersion,
                msgIn);
            BaseTestSite.Assert.AreEqual <uint>(
                (uint)Win32ErrorCode_32.ERROR_DS_DRA_INVALID_PARAMETER,
                ret,
                "DrsReplicaSync: return code mismatch."
                );
        }