Add all the A tasks
This commit is contained in:
parent
2dd7375f96
commit
051504d65b
1608 changed files with 18584 additions and 0 deletions
1
Task/Active-Directory-Connect/0DESCRIPTION
Normal file
1
Task/Active-Directory-Connect/0DESCRIPTION
Normal file
|
|
@ -0,0 +1 @@
|
|||
The task is to establish a connection to an Active Directory or Lightweight Directory Access Protocol server.
|
||||
2
Task/Active-Directory-Connect/1META.yaml
Normal file
2
Task/Active-Directory-Connect/1META.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
note: Programming environment operations
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
objConn := CreateObject("ADODB.Connection")
|
||||
objCmd := CreateObject("ADODB.Command")
|
||||
objConn.Provider := "ADsDSOObject"
|
||||
objConn.Open()
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
#include <AD.au3>
|
||||
_AD_Open()
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#include <ldap.h>
|
||||
...
|
||||
char *name, *password;
|
||||
...
|
||||
LDAP *ld = ldap_init("ldap.somewhere.com", 389);
|
||||
ldap_simple_bind_s(ld, name, password);
|
||||
... after done with it...
|
||||
ldap_unbind(ld);
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
import java.io.IOException;
|
||||
|
||||
import org.apache.directory.ldap.client.api.LdapConnection;
|
||||
import org.apache.directory.ldap.client.api.LdapNetworkConnection;
|
||||
import org.apache.directory.shared.ldap.model.cursor.EntryCursor;
|
||||
import org.apache.directory.shared.ldap.model.entry.Entry;
|
||||
import org.apache.directory.shared.ldap.model.exception.LdapException;
|
||||
import org.apache.directory.shared.ldap.model.message.SearchScope;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class RDirectoryLDAP {
|
||||
|
||||
static final Logger log_;
|
||||
private static final String ldapHostName;
|
||||
private static final int ldapPort;
|
||||
private static LdapConnection connection;
|
||||
|
||||
static {
|
||||
log_ = LoggerFactory.getLogger(RDirectoryLDAP.class);
|
||||
connection = null;
|
||||
ldapHostName = "localhost";
|
||||
ldapPort = 10389;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
if (log_.isInfoEnabled()) { log_.info("LDAP Connection to " + ldapHostName + " on port " + ldapPort); }
|
||||
connection = new LdapNetworkConnection(ldapHostName, ldapPort);
|
||||
|
||||
try {
|
||||
if (log_.isTraceEnabled()) { log_.trace("LDAP bind"); }
|
||||
connection.bind();
|
||||
|
||||
if (log_.isTraceEnabled()) { log_.trace("LDAP unbind"); }
|
||||
connection.unBind();
|
||||
}
|
||||
catch (LdapException lex) {
|
||||
log_.error("LDAP Error", lex);
|
||||
}
|
||||
catch (IOException ex) {
|
||||
log_.error("I/O Error", ex);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
if (log_.isTraceEnabled()) { log_.trace("LDAP close connection"); }
|
||||
try {
|
||||
if (connection != null) {
|
||||
connection.close();
|
||||
}
|
||||
}
|
||||
catch (IOException ex) {
|
||||
log_.error("I/O Error on connection.close()", ex);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<?php
|
||||
$ldap = ldap_connect($hostname, $port);
|
||||
$success = ldap_bind($ldap, $username, $password);
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
use Net::LDAP;
|
||||
|
||||
my $ldap = Net::LDAP->new('ldap://ldap.example.com') or die $@;
|
||||
my $mesg = $ldap->bind( $bind_dn, password => $bind_pass );
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
(unless (=0 (setq Ldap (native "libldap.so" "ldap_open" 'N "example.com" 389)))
|
||||
(quit "Can't open LDAP") )
|
||||
|
||||
(native "libldap.so" "ldap_simple_bind_s" 'I Ldap "user" "password")
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import ldap
|
||||
|
||||
l = ldap.initialize("ldap://ldap.example.com")
|
||||
try:
|
||||
l.protocol_version = ldap.VERSION3
|
||||
l.set_option(ldap.OPT_REFERRALS, 0)
|
||||
|
||||
bind = l.simple_bind_s("me@example.com", "password")
|
||||
finally:
|
||||
l.unbind()
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
require 'rubygems'
|
||||
require 'net/ldap'
|
||||
ldap = Net::LDAP.new(:host => 'ldap.example.com', :base => 'o=companyname')
|
||||
ldap.authenticate('bind_dn', 'bind_pass')
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
package require ldap
|
||||
set conn [ldap::connect $host $port]
|
||||
ldap::bind $conn $user $password
|
||||
Loading…
Add table
Add a link
Reference in a new issue