Search in sources :

Example 11 with Int

use of net.sourceforge.myvd.types.Int in project OpenUnison by TremoloSecurity.

the class AccessLog method add.

public void add(AddInterceptorChain chain, Entry entry, LDAPConstraints constraints) throws LDAPException {
    long start = System.currentTimeMillis();
    long end = 0;
    int result = -1;
    Int op = new Int(0);
    Int con = new Int(0);
    this.getOpNum(chain.getSession(), con, op);
    StringBuffer buf = new StringBuffer("ADD op=").append(op.getValue()).append(" con=").append(con.getValue()).append(" dn='").append(entry.getEntry().getDN()).append("'");
    logger.info(buf.toString());
    try {
        chain.nextAdd(entry, constraints);
        result = 0;
    } catch (LDAPException le) {
        result = le.getResultCode();
        throw le;
    } finally {
        end = System.currentTimeMillis();
        if (result == -1) {
            result = LDAPException.OPERATIONS_ERROR;
        }
        buf.setLength(0);
        buf.append("RESULT op=").append(op.getValue()).append(" con=").append(con.getValue()).append(" result=").append(result).append(" time=").append(end - start);
        logger.info(buf.toString());
    }
}
Also used : LDAPException(com.novell.ldap.LDAPException) Int(net.sourceforge.myvd.types.Int)

Example 12 with Int

use of net.sourceforge.myvd.types.Int in project OpenUnison by TremoloSecurity.

the class AccessLog method search.

public void search(SearchInterceptorChain chain, DistinguishedName base, Int scope, Filter filter, ArrayList<Attribute> attributes, Bool typesOnly, Results results, LDAPSearchConstraints constraints) throws LDAPException {
    long start = System.currentTimeMillis();
    long end = 0;
    int result = -1;
    Int op = new Int(0);
    Int con = new Int(0);
    Int nentries = new Int(0);
    this.getOpNum(chain.getSession(), con, op);
    StringBuffer buf = new StringBuffer();
    Iterator<Attribute> it = attributes.iterator();
    while (it.hasNext()) {
        buf.append(it.next().getAttribute().getName()).append(' ');
    }
    buf = new StringBuffer("SRCH op=").append(op.getValue()).append(" con=").append(con.getValue()).append(" base='").append(base.getDN()).append("' filter='").append(filter.getRoot().toString()).append("' scope='").append(scope.getValue()).append("' attribs='").append(buf).append("'");
    StringBuffer b = new StringBuffer();
    b.append(AccessLog.ACCESS_LOG_SRCH_BEGIN).append(this.name);
    chain.getRequest().put(b.toString(), start);
    b.setLength(0);
    b.append(AccessLog.ACCESS_LOG_SRCH_CON).append(this.name);
    chain.getRequest().put(b.toString(), con);
    b.setLength(0);
    b.append(AccessLog.ACCESS_LOG_SRCH_OP).append(this.name);
    chain.getRequest().put(b.toString(), op);
    b.setLength(0);
    b.append(AccessLog.ACCESS_LOG_SRCH_COUNT).append(this.name);
    chain.getRequest().put(b.toString(), nentries);
    logger.info(buf.toString());
    try {
        chain.nextSearch(base, scope, filter, attributes, typesOnly, results, constraints);
        result = 0;
    } catch (LDAPException le) {
        result = le.getResultCode();
        throw le;
    } finally {
        end = System.currentTimeMillis();
        if (result == -1) {
            result = LDAPException.OPERATIONS_ERROR;
        }
        buf.setLength(0);
        buf.append("RESULT op=").append(op.getValue()).append(" con=").append(con.getValue()).append(" result=").append(result).append(" time=").append(end - start);
        logger.info(buf.toString());
    }
}
Also used : LDAPException(com.novell.ldap.LDAPException) Attribute(net.sourceforge.myvd.types.Attribute) Int(net.sourceforge.myvd.types.Int)

Example 13 with Int

use of net.sourceforge.myvd.types.Int in project OpenUnison by TremoloSecurity.

the class AccessLog method modify.

public void modify(ModifyInterceptorChain chain, DistinguishedName dn, ArrayList<LDAPModification> mods, LDAPConstraints constraints) throws LDAPException {
    long start = System.currentTimeMillis();
    long end = 0;
    int result = -1;
    Int op = new Int(0);
    Int con = new Int(0);
    this.getOpNum(chain.getSession(), con, op);
    StringBuffer buf = new StringBuffer("MOD op=").append(op.getValue()).append(" con=").append(con.getValue()).append(" dn='").append(dn.getDN()).append("'");
    logger.info(buf.toString());
    try {
        chain.nextModify(dn, mods, constraints);
        result = 0;
    } catch (LDAPException le) {
        result = le.getResultCode();
        throw le;
    } finally {
        end = System.currentTimeMillis();
        if (result == -1) {
            result = LDAPException.OPERATIONS_ERROR;
        }
        buf.setLength(0);
        buf.append("RESULT op=").append(op.getValue()).append(" con=").append(con.getValue()).append(" result=").append(result).append(" time=").append(end - start);
        logger.info(buf.toString());
    }
}
Also used : LDAPException(com.novell.ldap.LDAPException) Int(net.sourceforge.myvd.types.Int)

Aggregations

Int (net.sourceforge.myvd.types.Int)13 LDAPException (com.novell.ldap.LDAPException)10 LDAPAttribute (com.novell.ldap.LDAPAttribute)3 LDAPSearchConstraints (com.novell.ldap.LDAPSearchConstraints)3 SearchInterceptorChain (net.sourceforge.myvd.chain.SearchInterceptorChain)3 Attribute (net.sourceforge.myvd.types.Attribute)3 Bool (net.sourceforge.myvd.types.Bool)3 DistinguishedName (net.sourceforge.myvd.types.DistinguishedName)3 Filter (net.sourceforge.myvd.types.Filter)3 Results (net.sourceforge.myvd.types.Results)3 LDAPEntry (com.novell.ldap.LDAPEntry)2 ArrayList (java.util.ArrayList)2 Gson (com.google.gson.Gson)1 LDAPSearchResults (com.novell.ldap.LDAPSearchResults)1 DN (com.novell.ldap.util.DN)1 Token (com.tremolosecurity.json.Token)1 TOTPKey (com.tremolosecurity.proxy.auth.otp.TOTPKey)1 GoogleAuthenticator (com.warrenstrange.googleauth.GoogleAuthenticator)1 GoogleAuthenticatorConfig (com.warrenstrange.googleauth.GoogleAuthenticatorConfig)1 GoogleAuthenticatorConfigBuilder (com.warrenstrange.googleauth.GoogleAuthenticatorConfig.GoogleAuthenticatorConfigBuilder)1