Lists all the replicas that reside on the the specified directory server. To list replicas, you must create an instance of this class and then call the extendedOperation method with this object as the required LdapExtendedOperation parameter. The listReplicaRequest extension uses the following OID: 2.16.840.1.113719.1.27.100.19 The requestValue has the following format: requestValue ::= serverName LdapDN
Inheritance: Novell.Directory.Ldap.LdapExtendedOperation
Esempio n. 1
0
    public static void  Main(System.String[] args)
    {
        if (args.Length != 5)
        {
            System.Console.Error.WriteLine("Usage:   mono ListReplicas <host Name> " + "<port number> <login dn> <password>" + "\n         <server ND>");
            System.Console.Error.WriteLine("Example: mono ListReplicas Acme.com 389 " + "\"cn=Admin,o=Acme\" secret" + "\n         \"cn=myServer,o=Acme\"");
            System.Environment.Exit(1);
        }

        int ldapVersion = LdapConnection.Ldap_V3;

        System.String ldapHost = args[0];
        int           ldapPort = System.Int32.Parse(args[1]);

        System.String  loginDN  = args[2];
        System.String  password = args[3];
        System.String  serverDN = args[4];
        LdapConnection ld       = new LdapConnection();

        try
        {
            // connect to the server
            ld.Connect(ldapHost, ldapPort);
            // bind to the server
            ld.Bind(ldapVersion, loginDN, password);
            System.Console.Out.WriteLine("\nLogin succeeded");

            LdapExtendedOperation request = new ListReplicasRequest(serverDN);

            LdapExtendedResponse response = ld.ExtendedOperation(request);

            if ((response.ResultCode == LdapException.SUCCESS) && (response is ListReplicasResponse))
            {
                System.Console.Out.WriteLine("Replica List: ");
                System.String[] rList = ((ListReplicasResponse)response).ReplicaList;
                int             len   = rList.Length;
                for (int i = 0; i < len; i++)
                {
                    System.Console.Out.WriteLine(rList[i]);
                }

                System.Console.Out.WriteLine("\nList replica request succeeded\n");
            }
            else
            {
                System.Console.Out.WriteLine("List Replicas request failed." + response.ResultCode);
//				throw new LdapException(response.ErrorMessage, response.ResultCode, (System.String) null);
            }

            /* Done, so disconnect */
            if (ld.Connected)
            {
                ld.Disconnect();
            }
        }
        catch (LdapException e)
        {
            System.Console.Out.WriteLine("\nError: " + e.ToString());
        }
    }
Esempio n. 2
0
    public static void Main(System.String[] args)
    {
        if (args.Length != 5)
        {
            System.Console.Error.WriteLine("Usage:   mono ListReplicas <host Name> " + "<port number> <login dn> <password>" + "\n         <server ND>");
            System.Console.Error.WriteLine("Example: mono ListReplicas Acme.com 389 " + "\"cn=Admin,o=Acme\" secret" + "\n         \"cn=myServer,o=Acme\"");
            System.Environment.Exit(1);
        }

        int ldapVersion = LdapConnection.Ldap_V3;
        System.String ldapHost = args[0];
        int ldapPort = System.Int32.Parse(args[1]);
        System.String loginDN = args[2];
        System.String password = args[3];
        System.String serverDN = args[4];
        LdapConnection ld = new LdapConnection();

        try
        {
            // connect to the server
            ld.Connect(ldapHost, ldapPort);
            // bind to the server
            ld.Bind(ldapVersion, loginDN, password);
            System.Console.Out.WriteLine("\nLogin succeeded");

            LdapExtendedOperation request = new ListReplicasRequest(serverDN);

            LdapExtendedResponse response = ld.ExtendedOperation(request);

            if ((response.ResultCode == LdapException.SUCCESS) && (response is ListReplicasResponse))
            {
                System.Console.Out.WriteLine("Replica List: ");
                System.String[] rList = ((ListReplicasResponse) response).ReplicaList;
                int len = rList.Length;
                for (int i = 0; i < len; i++)
                    System.Console.Out.WriteLine(rList[i]);

                System.Console.Out.WriteLine("\nList replica request succeeded\n");
            }
            else
            {
                System.Console.Out.WriteLine("List Replicas request failed." + response.ResultCode);
        //				throw new LdapException(response.ErrorMessage, response.ResultCode, (System.String) null);
            }

            /* Done, so disconnect */
            if (ld.Connected)
                ld.Disconnect();
        }
        catch (LdapException e)
        {
            System.Console.Out.WriteLine("\nError: " + e.ToString());
        }
    }