The following document contains the results of PMD's CPD 4.2.4.
File | Project | Line |
---|---|---|
org/apache/directory/server/core/partition/impl/btree/gui/IndexDialog.java | ApacheDS Core | 64 |
org/apache/directory/server/xdbm/tools/IndexDialog.java | ApacheDS Generalized (X) DBM Tools | 64 |
public class IndexDialog<K,O> extends JDialog { private static final Logger LOG = LoggerFactory.getLogger( IndexDialog.class ); private static final long serialVersionUID = 3689917253680445238L; public static final String DEFAULT_CURSOR = "Default"; public static final String EQUALITY_CURSOR = "Equality"; public static final String GREATER_CURSOR = "Greater"; public static final String LESS_CURSOR = "Less"; public static final String REGEX_CURSOR = "Regex"; private Panel mainPnl = new Panel(); private JTabbedPane tabbedPane = new JTabbedPane(); private JPanel listPnl = new JPanel(); private JPanel cursorPnl = new JPanel(); private JPanel resultsPnl = new JPanel(); private JScrollPane jScrollPane2 = new JScrollPane(); private JTable resultsTbl = new JTable(); private JPanel buttonPnl = new JPanel(); private JButton doneBut = new JButton(); private JLabel jLabel1 = new JLabel(); private JTextField keyText = new JTextField(); private JLabel jLabel2 = new JLabel(); private JButton scanBut = new JButton(); private Index<K,O> index = null; public IndexDialog( Frame parent, boolean modal, Index<K,O> index ) { super( parent, modal ); this.index = index; initGUI(); } public IndexDialog( Index<K,O> index ) { super(); this.index = index; initGUI(); } /** * This method is called from within the constructor to initialize the * form. */ private void initGUI() { addWindowListener( new java.awt.event.WindowAdapter() { public void windowClosing( java.awt.event.WindowEvent evt ) { closeDialog(); } } ); pack(); setTitle( "Index On Attribute '" + index.getAttribute().getName() + "'" ); setBounds( new java.awt.Rectangle( 0, 0, 512, 471 ) ); getContentPane().add( mainPnl, java.awt.BorderLayout.CENTER ); mainPnl.setLayout( new java.awt.BorderLayout() ); mainPnl.add( tabbedPane, java.awt.BorderLayout.CENTER ); tabbedPane.add( listPnl, "Listing" ); listPnl.setLayout( new java.awt.GridBagLayout() ); RadioButtonListener radioListener = new RadioButtonListener(); JRadioButton radioDefault = new JRadioButton( DEFAULT_CURSOR ); radioDefault.setActionCommand( DEFAULT_CURSOR ); radioDefault.setSelected( true ); radioDefault.addActionListener( radioListener ); JRadioButton radioEquality = new JRadioButton( EQUALITY_CURSOR ); radioEquality.setActionCommand( EQUALITY_CURSOR ); radioEquality.addActionListener( radioListener ); JRadioButton radioGreater = new JRadioButton( GREATER_CURSOR ); radioGreater.setActionCommand( GREATER_CURSOR ); radioGreater.addActionListener( radioListener ); JRadioButton radioLess = new JRadioButton( LESS_CURSOR ); radioLess.setActionCommand( LESS_CURSOR ); radioLess.addActionListener( radioListener ); JRadioButton radioRegex = new JRadioButton( REGEX_CURSOR ); radioRegex.setActionCommand( REGEX_CURSOR ); radioRegex.addActionListener( radioListener ); ButtonGroup group = new ButtonGroup(); group.add( radioDefault ); group.add( radioEquality ); group.add( radioGreater ); group.add( radioLess ); group.add( radioRegex ); JPanel radioPanel = new JPanel(); radioPanel.setLayout( new BoxLayout( radioPanel, BoxLayout.X_AXIS ) ); radioPanel.add( radioDefault ); radioPanel.add( radioEquality ); radioPanel.add( radioGreater ); radioPanel.add( radioLess ); radioPanel.add( radioRegex ); listPnl.add( cursorPnl, new java.awt.GridBagConstraints( 0, 0, 1, 1, 1.0, 0.15, java.awt.GridBagConstraints.NORTH, java.awt.GridBagConstraints.BOTH, new java.awt.Insets( 15, 0, 30, 0 ), 0, 0 ) ); listPnl.add( resultsPnl, new java.awt.GridBagConstraints( 0, 1, 1, 1, 1.0, 0.8, java.awt.GridBagConstraints.CENTER, java.awt.GridBagConstraints.BOTH, new java.awt.Insets( 0, 0, 0, 0 ), 0, 0 ) ); listPnl.add( buttonPnl, new java.awt.GridBagConstraints( 0, 2, 1, 1, 1.0, 0.05, java.awt.GridBagConstraints.CENTER, java.awt.GridBagConstraints.BOTH, new java.awt.Insets( 0, 0, 0, 0 ), 0, 0 ) ); cursorPnl.setLayout( new java.awt.GridBagLayout() ); cursorPnl.setBorder( javax.swing.BorderFactory.createTitledBorder( javax.swing.BorderFactory.createLineBorder( new java.awt.Color( 153, 153, 153 ), 1 ), "Display Cursor Constraints", javax.swing.border.TitledBorder.LEADING, javax.swing.border.TitledBorder.TOP, new java.awt.Font( "SansSerif", 0, 14 ), new java.awt.Color( 60, 60, 60 ) ) ); cursorPnl.add( jLabel1, new java.awt.GridBagConstraints( 0, 1, 1, 1, 0.0, 0.0, java.awt.GridBagConstraints.WEST, java.awt.GridBagConstraints.NONE, new java.awt.Insets( 0, 15, 0, 10 ), 0, 0 ) ); cursorPnl.add( keyText, new java.awt.GridBagConstraints( 1, 1, 1, 1, 0.4, 0.0, java.awt.GridBagConstraints.WEST, java.awt.GridBagConstraints.BOTH, new java.awt.Insets( 5, 5, 5, 236 ), 0, 0 ) ); cursorPnl.add( jLabel2, new java.awt.GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, java.awt.GridBagConstraints.WEST, java.awt.GridBagConstraints.NONE, new java.awt.Insets( 0, 15, 0, 10 ), 0, 0 ) ); cursorPnl.add( radioPanel, new java.awt.GridBagConstraints( 1, 0, 1, 1, 0.4, 0.0, java.awt.GridBagConstraints.WEST, java.awt.GridBagConstraints.NONE, new java.awt.Insets( 5, 5, 5, 0 ), 0, 0 ) ); resultsPnl.setLayout( new java.awt.BorderLayout() ); resultsPnl.setBorder( javax.swing.BorderFactory.createTitledBorder( javax.swing.BorderFactory.createLineBorder( new java.awt.Color( 153, 153, 153 ), 1 ), "Scan Results", javax.swing.border.TitledBorder.LEADING, javax.swing.border.TitledBorder.TOP, new java.awt.Font( "SansSerif", 0, 14 ), new java.awt.Color( 60, 60, 60 ) ) ); resultsPnl.add( jScrollPane2, java.awt.BorderLayout.CENTER ); jScrollPane2.getViewport().add( resultsTbl ); buttonPnl.setLayout( new java.awt.FlowLayout( java.awt.FlowLayout.CENTER, 15, 5 ) ); buttonPnl.add( doneBut ); buttonPnl.add( scanBut ); doneBut.setText( "Done" ); doneBut.addActionListener( new ActionListener() { public void actionPerformed( ActionEvent e ) { closeDialog(); } } ); jLabel1.setText( "Key Constraint:" ); keyText.setText( "" ); keyText.setMinimumSize( new java.awt.Dimension( 130, 20 ) ); keyText.setPreferredSize( new java.awt.Dimension( 130, 20 ) ); keyText.setMaximumSize( new java.awt.Dimension( 130, 20 ) ); keyText.setFont( new java.awt.Font( "SansSerif", java.awt.Font.PLAIN, 14 ) ); keyText.setSize( new java.awt.Dimension( 130, 20 ) ); jLabel2.setText( "Cursor Type:" ); scanBut.setText( "Scan" ); scanBut.addActionListener( new ActionListener() { |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/partition/impl/btree/gui/IndexDialog.java | ApacheDS Core | 226 |
org/apache/directory/server/xdbm/tools/IndexDialog.java | ApacheDS Generalized (X) DBM Tools | 227 |
public void actionPerformed( ActionEvent e ) { //noinspection unchecked doScan( ( K ) keyText.getText(), selectedCursorType ); } } ); doScan( null, DEFAULT_CURSOR ); } private String selectedCursorType = DEFAULT_CURSOR; class RadioButtonListener implements ActionListener { public void actionPerformed( ActionEvent e ) { if ( e.getActionCommand().equals( DEFAULT_CURSOR ) ) { selectedCursorType = DEFAULT_CURSOR; } else if ( e.getActionCommand().equals( EQUALITY_CURSOR ) ) { selectedCursorType = EQUALITY_CURSOR; } else if ( e.getActionCommand().equals( GREATER_CURSOR ) ) { selectedCursorType = GREATER_CURSOR; } else if ( e.getActionCommand().equals( LESS_CURSOR ) ) { selectedCursorType = LESS_CURSOR; } else if ( e.getActionCommand().equals( REGEX_CURSOR ) ) { selectedCursorType = REGEX_CURSOR; } } } private void closeDialog() { setVisible( false ); dispose(); } public boolean doScan( K key, String scanType ) { if ( key == null && ! scanType.equals( DEFAULT_CURSOR ) ) { JOptionPane.showMessageDialog( null, "Cannot use a " + scanType + " scan type with a null key constraint.", "Missing Key Constraint", JOptionPane.ERROR_MESSAGE ); return false; } Object[] cols = new Object[2]; Object[] row; cols[0] = "Keys ( Attribute Value )"; cols[1] = "Values ( Entry Id )"; DefaultTableModel model = new DefaultTableModel( cols, 0 ); int count = 0; try { Cursor<IndexEntry<K, O>> list; if ( scanType.equals( EQUALITY_CURSOR ) ) { list = index.forwardCursor( key ); list.beforeFirst(); while ( list.next() ) { IndexEntry<K,O> rec = list.get(); row = new Object[2]; row[0] = rec.getValue(); row[1] = rec.getId(); model.addRow( row ); count++; } } else if ( scanType.equals( GREATER_CURSOR ) ) { list = index.forwardCursor(); ForwardIndexEntry<K, O> entry = new ForwardIndexEntry<K, O>(); entry.setValue( key ); list.before( entry ); while ( list.next() ) { IndexEntry<K,O> rec = list.get(); row = new Object[2]; row[0] = rec.getValue(); row[1] = rec.getId(); model.addRow( row ); count++; } } else if ( scanType.equals( LESS_CURSOR ) ) { list = index.forwardCursor(); ForwardIndexEntry<K, O> entry = new ForwardIndexEntry<K, O>(); entry.setValue( key ); list.after( entry ); while ( list.previous() ) { IndexEntry<K,O> rec = list.get(); row = new Object[2]; row[0] = rec.getValue(); row[1] = rec.getId(); model.addRow( row ); count++; } } else if ( scanType.equals( REGEX_CURSOR ) ) { // Pattern regex = StringTools.getRegex( key ); // int starIndex = key.indexOf( '*' ); // // if ( starIndex > 0 ) // { // String prefix = key.substring( 0, starIndex ); // // if ( log.isDebugEnabled() ) // log.debug( "Regex prefix = " + prefix ); // // list = index.listIndices( regex, prefix ); // } // else // { // list = index.listIndices( regex ); // } throw new NotImplementedException(); } else { list = index.forwardCursor(); while ( list.next() ) { IndexEntry<K,O> rec = list.get(); row = new Object[2]; row[0] = rec.getValue(); row[1] = rec.getId(); model.addRow( row ); count++; } } resultsTbl.setModel( model ); resultsPnl.setBorder( BorderFactory.createTitledBorder( BorderFactory.createLineBorder( new Color( 153, 153, 153 ), 1 ), "Scan Results: " + count, TitledBorder.LEADING, TitledBorder.TOP, new Font( "SansSerif", 0, 14 ), new Color( 60, 60, 60 ) ) ); if ( isVisible() ) { validate(); } } catch ( Exception e ) { String msg = ExceptionUtils.getStackTrace( e ); if ( msg.length() > 1024 ) { msg = msg.substring( 0, 1024 ) + "\n. . . TRUNCATED . . ."; } msg = "Error while scanning index " + "on attribute " + index.getAttribute() + " using a " + scanType + " cursor type with a key constraint of '" + key + "':\n" + msg; LOG.error( msg, e ); JTextArea area = new JTextArea(); area.setText( msg ); JOptionPane.showMessageDialog( null, area, "Index Scan Error", JOptionPane.ERROR_MESSAGE ); return false; } return true; } |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/partition/impl/btree/gui/AddEntryDialog.java | ApacheDS Core | 108 |
org/apache/directory/server/core/partition/impl/btree/gui/EntryDialog.java | ApacheDS Core | 94 |
setTitle( "Entry Dialog" ); getContentPane().setLayout( new java.awt.GridBagLayout() ); getContentPane().add( m_namePnl, new java.awt.GridBagConstraints( 0, 0, 1, 1, 1.0, 0.0, java.awt.GridBagConstraints.NORTH, java.awt.GridBagConstraints.HORIZONTAL, new java.awt.Insets( 5, 5, 5, 5 ), 0, 0 ) ); getContentPane().add( m_attrPnl, new java.awt.GridBagConstraints( 0, 1, 1, 1, 1.0, 1.0, java.awt.GridBagConstraints.CENTER, java.awt.GridBagConstraints.BOTH, new java.awt.Insets( 5, 5, 5, 5 ), 0, 0 ) ); getContentPane().add( m_buttonPnl, new java.awt.GridBagConstraints( 0, 2, 1, 1, 1.0, 0.05, java.awt.GridBagConstraints.CENTER, java.awt.GridBagConstraints.HORIZONTAL, new java.awt.Insets( 0, 0, 0, 20 ), 0, 0 ) ); m_namePnl.setBorder( javax.swing.BorderFactory.createTitledBorder( javax.swing.BorderFactory.createLineBorder( new java.awt.Color( 153, 153, 153 ), 1 ), "Naming", javax.swing.border.TitledBorder.LEADING, javax.swing.border.TitledBorder.TOP, new java.awt.Font( "SansSerif", 0, 14 ), new java.awt.Color( 60, 60, 60 ) ) ); m_namePnl.setLayout( new javax.swing.BoxLayout( m_namePnl, javax.swing.BoxLayout.Y_AXIS ) ); m_namePnl.add( m_rdnPnl ); m_namePnl.add( m_dnPnl ); m_rdnLbl.setText( "Rdn:" ); m_rdnPnl.setLayout( new java.awt.GridBagLayout() ); m_rdnPnl.add( m_rdnChoice, new java.awt.GridBagConstraints( 1, 0, 1, 1, 1.0, 0.0, java.awt.GridBagConstraints.WEST, java.awt.GridBagConstraints.NONE, new java.awt.Insets( 0, 10, 0, 0 ), 0, 0 ) ); m_rdnPnl.add( m_rdnLbl, new java.awt.GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, java.awt.GridBagConstraints.WEST, java.awt.GridBagConstraints.NONE, new java.awt.Insets( 0, 10, 0, 0 ), 0, 0 ) ); m_dnPnl.setLayout( new java.awt.GridBagLayout() ); m_dnPnl.add( m_dnText, new java.awt.GridBagConstraints( 1, 0, 1, 1, 1.0, 0.0, java.awt.GridBagConstraints.WEST, java.awt.GridBagConstraints.HORIZONTAL, new java.awt.Insets( 0, 5, 0, 0 ), 0, 0 ) ); m_dnText.setText( "unknown" ); m_dnText.setEditable( false ); m_dnText.setBorder( javax.swing.BorderFactory.createTitledBorder( javax.swing.BorderFactory.createLineBorder( new java.awt.Color( 153, 153, 153 ), 1 ), "Dn", javax.swing.border.TitledBorder.LEADING, javax.swing.border.TitledBorder.TOP, new java.awt.Font( "SansSerif", 0, 14 ), new java.awt.Color( 60, 60, 60 ) ) ); m_rdnChoice.setEditable( true ); m_rdnChoice.setMaximumRowCount( 6 ); m_rdnChoice.setSize( new java.awt.Dimension( 130, 24 ) ); m_attrPnl.setLayout( new java.awt.BorderLayout() ); m_attrPnl.add( m_attrScrollPnl, java.awt.BorderLayout.CENTER ); m_attrScrollPnl.getViewport().add( m_attrTbl ); m_attrTbl.setBounds( new java.awt.Rectangle( 78, 60, 32, 32 ) ); m_attrTbl.setEditingColumn( 1 ); |
File | Project | Line |
---|---|---|
org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java | ApacheDS Generalized (X) DBM Search Engine | 108 |
org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java | ApacheDS Generalized (X) DBM Search Engine | 138 |
public void afterValue( Long id, Long value ) throws Exception { throw new UnsupportedOperationException( UNSUPPORTED_MSG ); } public void after( IndexEntry<Long, ServerEntry> element ) throws Exception { throw new UnsupportedOperationException( UNSUPPORTED_MSG ); } public void beforeFirst() throws Exception { checkNotClosed( "beforeFirst()" ); cursor = scopeCursor; cursor.beforeFirst(); available = false; } public void afterLast() throws Exception { checkNotClosed( "afterLast()" ); if ( evaluator.isDereferencing() ) { cursor = dereferencedCursor; } else { cursor = scopeCursor; } cursor.afterLast(); available = false; } public boolean first() throws Exception { beforeFirst(); return next(); } public boolean last() throws Exception { afterLast(); return previous(); } public boolean previous() throws Exception { checkNotClosed( "previous()" ); // if the cursor has not been set - position it after last element if ( cursor == null ) { afterLast(); } // if we're using the scopeCursor (1st Cursor) then return result as is if ( cursor == scopeCursor ) { /* * If dereferencing is enabled then we must ignore alias entries, not * returning them as part of the results. */ if ( evaluator.isDereferencing() ) { // advance until nothing is available or until we find a non-alias do { checkNotClosed( "previous()" ); available = cursor.previous(); if ( available && db.getAliasIndex().reverseLookup( cursor.get().getId() ) == null ) { break; } } while ( available ); } else { available = cursor.previous(); } return available; } /* * Below here we are using the dereferencedCursor so if nothing is * available after an advance backwards we need to switch to the * scopeCursor and try a previous call after positioning past it's * last element. */ available = cursor.previous(); if ( ! available ) { cursor = scopeCursor; cursor.afterLast(); // advance until nothing is available or until we find a non-alias do { checkNotClosed( "previous()" ); available = cursor.previous(); if ( available && db.getAliasIndex().reverseLookup( cursor.get().getId() ) == null ) { break; } } while ( available ); return available; } return true; } public boolean next() throws Exception { checkNotClosed( "next()" ); // if the cursor hasn't been set position it before the first element if ( cursor == null ) { beforeFirst(); } /* * If dereferencing is enabled then we must ignore alias entries, not * returning them as part of the results. */ if ( evaluator.isDereferencing() ) { // advance until nothing is available or until we find a non-alias do { checkNotClosed( "next()" ); available = cursor.next(); if ( available && db.getAliasIndex().reverseLookup( cursor.get().getId() ) == null ) { break; } } while ( available ); } else { available = cursor.next(); } // if we're using dereferencedCursor (2nd) then we return the result if ( cursor == dereferencedCursor ) { return available; } /* * Below here we are using the scopeCursor so if nothing is * available after an advance forward we need to switch to the * dereferencedCursor and try a previous call after positioning past * it's last element. */ if ( ! available ) { if ( dereferencedCursor != null ) { cursor = dereferencedCursor; cursor.beforeFirst(); return available = cursor.next(); } return false; } return true; } public IndexEntry<Long, ServerEntry> get() throws Exception { checkNotClosed( "get()" ); if ( available ) { return cursor.get(); } throw new InvalidCursorPositionException( "Cursor has not been positioned yet." ); } public boolean isElementReused() { return scopeCursor.isElementReused() || ( dereferencedCursor != null && dereferencedCursor.isElementReused() ); } } |
File | Project | Line |
---|---|---|
org/apache/directory/server/kerberos/shared/crypto/encryption/DesCbcCrcEncryption.java | ApacheDS Protocol Kerberos Shared | 89 |
org/apache/directory/server/kerberos/shared/crypto/encryption/DesCbcMd5Encryption.java | ApacheDS Protocol Kerberos Shared | 81 |
} public byte[] getDecryptedData( EncryptionKey key, EncryptedData data, KeyUsage usage ) throws KerberosException { // decrypt the data byte[] decryptedData = decrypt( data.getCipher(), key.getKeyValue() ); // extract the old checksum byte[] oldChecksum = new byte[getChecksumLength()]; System.arraycopy( decryptedData, getConfounderLength(), oldChecksum, 0, oldChecksum.length ); // zero out the old checksum in the cipher text for ( int i = getConfounderLength(); i < getConfounderLength() + getChecksumLength(); i++ ) { decryptedData[i] = 0; } // calculate a new checksum byte[] newChecksum = calculateIntegrity( decryptedData, key.getKeyValue(), usage ); // compare checksums if ( !Arrays.equals( oldChecksum, newChecksum ) ) { throw new KerberosException( ErrorType.KRB_AP_ERR_BAD_INTEGRITY ); } // remove leading confounder and checksum return removeLeadingBytes( decryptedData, getConfounderLength(), getChecksumLength() ); } public EncryptedData getEncryptedData( EncryptionKey key, byte[] plainText, KeyUsage usage ) { // build the ciphertext structure byte[] conFounder = getRandomBytes( getConfounderLength() ); byte[] zeroedChecksum = new byte[getChecksumLength()]; byte[] dataBytes = concatenateBytes( conFounder, concatenateBytes( zeroedChecksum, plainText ) ); byte[] paddedDataBytes = padString( dataBytes ); byte[] checksumBytes = calculateIntegrity( paddedDataBytes, null, usage ); // lay the checksum into the ciphertext for ( int i = getConfounderLength(); i < getConfounderLength() + getChecksumLength(); i++ ) { paddedDataBytes[i] = checksumBytes[i - getConfounderLength()]; } byte[] encryptedData = encrypt( paddedDataBytes, key.getKeyValue() ); return new EncryptedData( getEncryptionType(), key.getKeyVersion(), encryptedData ); } public byte[] encrypt( byte[] plainText, byte[] keyBytes ) { return processCipher( true, plainText, keyBytes ); } public byte[] decrypt( byte[] cipherText, byte[] keyBytes ) { return processCipher( false, cipherText, keyBytes ); } private byte[] processCipher( boolean isEncrypt, byte[] data, byte[] keyBytes ) { try { Cipher cipher = Cipher.getInstance( "DES/CBC/NoPadding" ); SecretKey key = new SecretKeySpec( keyBytes, "DES" ); AlgorithmParameterSpec paramSpec = new IvParameterSpec( iv ); if ( isEncrypt ) { cipher.init( Cipher.ENCRYPT_MODE, key, paramSpec ); } else { cipher.init( Cipher.DECRYPT_MODE, key, paramSpec ); } return cipher.doFinal( data ); } catch ( GeneralSecurityException nsae ) { nsae.printStackTrace(); return null; } } } |
File | Project | Line |
---|---|---|
org/apache/directory/server/tools/DumpCommand.java | ApacheDS Server Tools | 97 |
org/apache/directory/server/tools/IndexCommand.java | ApacheDS Server Tools | 89 |
private Registries loadRegistries() throws Exception { // -------------------------------------------------------------------- // Load the bootstrap schemas to start up the schema partition // -------------------------------------------------------------------- // setup temporary loader and temp registry BootstrapSchemaLoader loader = new BootstrapSchemaLoader(); OidRegistry oidRegistry = new DefaultOidRegistry(); final Registries registries = new DefaultRegistries( "bootstrap", loader, oidRegistry ); // load essential bootstrap schemas Set<Schema> bootstrapSchemas = new HashSet<Schema>(); bootstrapSchemas.add( new ApachemetaSchema() ); bootstrapSchemas.add( new ApacheSchema() ); bootstrapSchemas.add( new CoreSchema() ); bootstrapSchemas.add( new SystemSchema() ); loader.loadWithDependencies( bootstrapSchemas, registries ); // run referential integrity tests List<Throwable> errors = registries.checkRefInteg(); if ( !errors.isEmpty() ) { MultiException e = new MultiException(); for ( Throwable t : errors ) { e.addThrowable( t ); } throw e; } SerializableComparator.setRegistry( registries.getComparatorRegistry() ); // -------------------------------------------------------------------- // Initialize schema partition or bomb out if we cannot find it on disk // -------------------------------------------------------------------- // If not present then we need to abort File schemaDirectory = new File( getLayout().getPartitionsDirectory(), "schema" ); if ( !schemaDirectory.exists() ) { throw new LdapConfigurationException( "The following schema directory from " + "the installation layout could not be found:\n\t" + schemaDirectory ); } JdbmPartition schemaPartition = new JdbmPartition(); schemaPartition.setId( "schema" ); schemaPartition.setCacheSize( 1000 ); DbFileListing listing; try { listing = new DbFileListing(); } catch ( IOException e ) { throw new LdapNamingException( "Got IOException while trying to read DBFileListing: " + e.getMessage(), ResultCodeEnum.OTHER ); } Set<Index<?,ServerEntry>> indexedAttributes = new HashSet<Index<?,ServerEntry>>(); for ( String attributeId : listing.getIndexedAttributes() ) { indexedAttributes.add( new JdbmIndex( attributeId ) ); } schemaPartition.setIndexedAttributes( indexedAttributes ); schemaPartition.setSuffix( ServerDNConstants.OU_SCHEMA_DN ); DirectoryService directoryService = new DefaultDirectoryService(); schemaPartition.init( directoryService ); // -------------------------------------------------------------------- // Initialize schema subsystem and reset registries // -------------------------------------------------------------------- PartitionSchemaLoader schemaLoader = new PartitionSchemaLoader( schemaPartition, registries ); Registries globalRegistries = new DefaultRegistries( "global", schemaLoader, oidRegistry ); schemaLoader.loadEnabled( globalRegistries ); SerializableComparator.setRegistry( globalRegistries.getComparatorRegistry() ); return globalRegistries; } public void execute( CommandLine cmdline ) throws Exception { getLayout().verifyInstallation(); bootstrapRegistries = loadRegistries(); |
File | Project | Line |
---|---|---|
org/apache/directory/server/tools/CapacityTestCommand.java | ApacheDS Server Tools | 185 |
org/apache/directory/server/tools/DiagnosticCommand.java | ApacheDS Server Tools | 93 |
System.out.println( "Processing options for launching diagnostic UI ..." ); } // ------------------------------------------------------------------- // figure out and error check the port value // ------------------------------------------------------------------- if ( cmd.hasOption( 'p' ) ) // - user provided port w/ -p takes precedence { String val = cmd.getOptionValue( 'p' ); try { port = Integer.parseInt( val ); } catch ( NumberFormatException e ) { System.err.println( "port value of '" + val + "' is not a number" ); System.exit( 1 ); } if ( port > AvailablePortFinder.MAX_PORT_NUMBER ) { System.err.println( "port value of '" + val + "' is larger than max port number: " + AvailablePortFinder.MAX_PORT_NUMBER ); System.exit( 1 ); } else if ( port < AvailablePortFinder.MIN_PORT_NUMBER ) { System.err.println( "port value of '" + val + "' is smaller than the minimum port number: " + AvailablePortFinder.MIN_PORT_NUMBER ); System.exit( 1 ); } if ( isDebugEnabled() ) { System.out.println( "port overriden by -p option: " + port ); } } else if ( getApacheDS() != null ) { port = getApacheDS().getLdapService().getIpPort(); if ( isDebugEnabled() ) { System.out.println( "port overriden by server.xml configuration: " + port ); } } else if ( isDebugEnabled() ) { System.out.println( "port set to default: " + port ); } // ------------------------------------------------------------------- // figure out the host value // ------------------------------------------------------------------- if ( cmd.hasOption( 'h' ) ) { host = cmd.getOptionValue( 'h' ); if ( isDebugEnabled() ) { System.out.println( "host overriden by -h option: " + host ); } } else if ( isDebugEnabled() ) { System.out.println( "host set to default: " + host ); } // ------------------------------------------------------------------- // figure out the password value // ------------------------------------------------------------------- if ( cmd.hasOption( 'w' ) ) { password = cmd.getOptionValue( 'w' ); if ( isDebugEnabled() ) { System.out.println( "password overriden by -w option: " + password ); } } else if ( isDebugEnabled() ) { System.out.println( "password set to default: " + password ); } } public Options getOptions() { Options opts = new Options(); Option op = new Option( "h", "host", true, "server host: defaults to localhost" ); |
File | Project | Line |
---|---|---|
org/apache/directory/server/tools/DisconnectNotificationCommand.java | ApacheDS Server Tools | 191 |
org/apache/directory/server/tools/GracefulShutdownCommand.java | ApacheDS Server Tools | 185 |
System.out.println( "Processing options for graceful shutdown ..." ); } // ------------------------------------------------------------------- // figure out and error check the port value // ------------------------------------------------------------------- if ( cmd.hasOption( 'p' ) ) // - user provided port w/ -p takes precedence { String val = cmd.getOptionValue( 'p' ); try { port = Integer.parseInt( val ); } catch ( NumberFormatException e ) { System.err.println( "port value of '" + val + "' is not a number" ); System.exit( 1 ); } if ( port > AvailablePortFinder.MAX_PORT_NUMBER ) { System.err.println( "port value of '" + val + "' is larger than max port number: " + AvailablePortFinder.MAX_PORT_NUMBER ); System.exit( 1 ); } else if ( port < AvailablePortFinder.MIN_PORT_NUMBER ) { System.err.println( "port value of '" + val + "' is smaller than the minimum port number: " + AvailablePortFinder.MIN_PORT_NUMBER ); System.exit( 1 ); } if ( isDebugEnabled() ) { System.out.println( "port overriden by -p option: " + port ); } } else if ( getApacheDS() != null ) { port = getApacheDS().getLdapService().getIpPort(); if ( isDebugEnabled() ) { System.out.println( "port overriden by server.xml configuration: " + port ); } } else if ( isDebugEnabled() ) { System.out.println( "port set to default: " + port ); } // ------------------------------------------------------------------- // figure out the host value // ------------------------------------------------------------------- if ( cmd.hasOption( 'h' ) ) { host = cmd.getOptionValue( 'h' ); if ( isDebugEnabled() ) { System.out.println( "host overriden by -h option: " + host ); } } else if ( isDebugEnabled() ) { System.out.println( "host set to default: " + host ); } // ------------------------------------------------------------------- // figure out the password value // ------------------------------------------------------------------- if ( cmd.hasOption( 'w' ) ) { password = cmd.getOptionValue( 'w' ); if ( isDebugEnabled() ) { System.out.println( "password overriden by -w option: " + password ); } } else if ( isDebugEnabled() ) { System.out.println( "password set to default: " + password ); } // ------------------------------------------------------------------- // figure out the delay value // ------------------------------------------------------------------- if ( cmd.hasOption( 'e' ) ) |
File | Project | Line |
---|---|---|
org/apache/directory/server/tools/CapacityTestCommand.java | ApacheDS Server Tools | 185 |
org/apache/directory/server/tools/GracefulShutdownCommand.java | ApacheDS Server Tools | 185 |
System.out.println( "Processing options for disconnect notifications ..." ); } // ------------------------------------------------------------------- // figure out and error check the port value // ------------------------------------------------------------------- if ( cmd.hasOption( 'p' ) ) // - user provided port w/ -p takes precedence { String val = cmd.getOptionValue( 'p' ); try { port = Integer.parseInt( val ); } catch ( NumberFormatException e ) { System.err.println( "port value of '" + val + "' is not a number" ); System.exit( 1 ); } if ( port > AvailablePortFinder.MAX_PORT_NUMBER ) { System.err.println( "port value of '" + val + "' is larger than max port number: " + AvailablePortFinder.MAX_PORT_NUMBER ); System.exit( 1 ); } else if ( port < AvailablePortFinder.MIN_PORT_NUMBER ) { System.err.println( "port value of '" + val + "' is smaller than the minimum port number: " + AvailablePortFinder.MIN_PORT_NUMBER ); System.exit( 1 ); } if ( isDebugEnabled() ) { System.out.println( "port overriden by -p option: " + port ); } } else if ( getApacheDS() != null ) { port = getApacheDS().getLdapService().getIpPort(); if ( isDebugEnabled() ) { System.out.println( "port overriden by server.xml configuration: " + port ); } } else if ( isDebugEnabled() ) { System.out.println( "port set to default: " + port ); } // ------------------------------------------------------------------- // figure out the host value // ------------------------------------------------------------------- if ( cmd.hasOption( 'h' ) ) { host = cmd.getOptionValue( 'h' ); if ( isDebugEnabled() ) { System.out.println( "host overriden by -h option: " + host ); } } else if ( isDebugEnabled() ) { System.out.println( "host set to default: " + host ); } // ------------------------------------------------------------------- // figure out the password value // ------------------------------------------------------------------- if ( cmd.hasOption( 'w' ) ) { password = cmd.getOptionValue( 'w' ); if ( isDebugEnabled() ) { System.out.println( "password overriden by -w option: " + password ); } } else if ( isDebugEnabled() ) { System.out.println( "password set to default: " + password ); } |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/integ/state/NonExistentState.java | ApacheDS Core Integration | 133 |
org/apache/directory/server/integ/state/NonExistentState.java | ApacheDS Server Integration | 134 |
public void test( TestClass testClass, TestMethod testMethod, RunNotifier notifier, InheritableServerSettings settings ) { LOG.debug( "calling test(): {}, mode {}", settings.getDescription().getDisplayName(), settings.getMode() ); if ( testMethod.isIgnored() ) { // The test is ignored return; } switch ( settings.getMode() ) { case CUMULATIVE: case RESTART: try { create( settings ); } catch ( NamingException ne ) { LOG.error( "Failed to create and start new server instance: " + ne ); notifier.testAborted( settings.getDescription(), ne ); return; } try { startup(); } catch ( Exception e ) { LOG.error( "Failed to create and start new server instance: " + e ); notifier.testAborted( settings.getDescription(), e ); return; } context.setState( context.getStartedNormalState() ); context.getState().test( testClass, testMethod, notifier, settings ); return; case PRISTINE: case ROLLBACK: try { create( settings ); } catch ( NamingException ne ) { LOG.error( "Failed to create and start new server instance: " + ne ); notifier.testAborted( settings.getDescription(), ne ); return; } try { cleanup(); } catch ( IOException ioe ) { LOG.error( "Failed to create and start new server instance: " + ioe ); notifier.testAborted( settings.getDescription(), ioe ); return; } try { startup(); } catch ( Exception e ) { LOG.error( "Failed to create and start new server instance: " + e ); notifier.testAborted( settings.getDescription(), e ); return; } context.setState( context.getStartedPristineState() ); context.getState().test( testClass, testMethod, notifier, settings ); return; default: return; } } } |
File | Project | Line |
---|---|---|
org/apache/directory/server/ldap/handlers/bind/cramMD5/CramMd5CallbackHandler.java | ApacheDS Protocol Ldap | 71 |
org/apache/directory/server/ldap/handlers/bind/digestMD5/DigestMd5CallbackHandler.java | ApacheDS Protocol Ldap | 70 |
public DigestMd5CallbackHandler( LdapSession ldapSession, CoreSession adminSession, BindRequest bindRequest ) { super( adminSession.getDirectoryService(), bindRequest ); this.ldapSession = ldapSession; this.adminSession = adminSession; } // TODO - should return not be a byte[] protected EntryAttribute lookupPassword( String username, String realm ) { try { ExprNode filter = FilterParser.parse( "(uid=" + username + ")" ); Set<AttributeTypeOptions> returningAttributes = new HashSet<AttributeTypeOptions>(); AttributeType passwordAT = adminSession.getDirectoryService().getRegistries().getAttributeTypeRegistry().lookup( SchemaConstants.USER_PASSWORD_AT ); returningAttributes.add( new AttributeTypeOptions( passwordAT) ); bindDn = (String)ldapSession.getSaslProperty( SaslConstants.SASL_USER_BASE_DN ); LdapDN baseDn = new LdapDN( bindDn ); EntryFilteringCursor cursor = adminSession.search( baseDn, SearchScope.SUBTREE, filter, AliasDerefMode.DEREF_ALWAYS, returningAttributes ); cursor.beforeFirst(); ClonedServerEntry entry = null; while ( cursor.next() ) { entry = cursor.get(); LdapPrincipal ldapPrincipal = new LdapPrincipal( entry.getDn(), AuthenticationLevel.STRONG, entry.get( SchemaConstants.USER_PASSWORD_AT ).getBytes() ); ldapSession.putSaslProperty( SaslConstants.SASL_AUTHENT_USER, ldapPrincipal ); } return entry.get( passwordAT ); } catch ( Exception e ) { return null; } } protected void authorize( AuthorizeCallback authorizeCB ) { if ( LOG.isDebugEnabled() ) { LOG.debug( "Converted username " + getUsername() + " to DN " + bindDn + " with password " + userPassword + "." ); |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/integ/InheritableSettings.java | ApacheDS Core Integration | 185 |
org/apache/directory/server/integ/InheritableServerSettings.java | ApacheDS Server Integration | 185 |
return ( LdapServerFactory ) annotation.value().newInstance(); } } /** * Get a list of entries from a LDIF declared as an annotation * * @param ldifs the list of LDIFs we want to feed * @return a list of entries described using a LDIF format */ public List<String> getLdifs( List<String> ldifs ) { if ( ldifs == null ) { ldifs = new ArrayList<String>(); } if ( parent != null ) { parent.getLdifs( ldifs ); } ApplyLdifs annotation = description.getAnnotation( ApplyLdifs.class ); if ( ( annotation != null ) && ( annotation.value() != null ) ) { ldifs.addAll( Arrays.asList( annotation.value() ) ); } return ldifs; } /** * Get a list of files containing entries described using the LDIF format. * * @param ldifFiles the list to feed * @return a list of files containing some LDIF data */ public List<String> getLdifFiles( List<String> ldifFiles ) { if ( ldifFiles == null ) { ldifFiles = new ArrayList<String>(); } if ( parent != null ) { parent.getLdifFiles( ldifFiles ); } ApplyLdifFiles annotation = description.getAnnotation( ApplyLdifFiles.class ); if ( annotation != null && annotation.value() != null ) { ldifFiles.addAll( Arrays.asList( annotation.value() ) ); } return ldifFiles; } /** * @return teh cleanup level. Defualt to SUITE */ public Level getCleanupLevel() { Level parentCleanupLevel = DEFAULT_CLEANUP_LEVEL; if ( parent != null ) { parentCleanupLevel = parent.getCleanupLevel(); } CleanupLevel annotation = description.getAnnotation( CleanupLevel.class ); if ( annotation == null ) { return parentCleanupLevel; } else { return annotation.value(); } } } |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/cursor/SingletonCursor.java | ApacheDS Core Cursor | 102 |
org/apache/directory/server/xdbm/SingletonIndexCursor.java | ApacheDS XDBM Base | 72 |
} public void beforeFirst() throws Exception { checkNotClosed( "()" ); beforeFirst = true; afterLast = false; onSingleton = false; } public void afterLast() throws Exception { checkNotClosed( "()" ); beforeFirst = false; afterLast = true; onSingleton = false; } public boolean first() throws Exception { checkNotClosed( "()" ); beforeFirst = false; onSingleton = true; afterLast = false; return true; } public boolean last() throws Exception { checkNotClosed( "()" ); beforeFirst = false; onSingleton = true; afterLast = false; return true; } public boolean isFirst() throws Exception { checkNotClosed( "()" ); return onSingleton; } public boolean isLast() throws Exception { checkNotClosed( "()" ); return onSingleton; } public boolean isAfterLast() throws Exception { checkNotClosed( "()" ); return afterLast; } public boolean isBeforeFirst() throws Exception { checkNotClosed( "()" ); return beforeFirst; } public boolean previous() throws Exception { checkNotClosed( "()" ); if ( beforeFirst ) { return false; } if ( afterLast ) { beforeFirst = false; onSingleton = true; afterLast = false; return true; } // must be on the singleton beforeFirst = true; onSingleton = false; afterLast = false; return false; } public boolean next() throws Exception { checkNotClosed( "()" ); if ( beforeFirst ) { beforeFirst = false; onSingleton = true; afterLast = false; return true; } if ( afterLast ) { return false; } // must be on the singleton beforeFirst = false; onSingleton = false; afterLast = true; return false; } public IndexEntry<K,E> get() throws Exception |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/kerberos/PasswordPolicyInterceptor.java | ApacheDS Interceptors for Kerberos | 266 |
org/apache/directory/server/changepw/service/CheckPasswordPolicy.java | ApacheDS Protocol Change Password | 139 |
if ( !Character.isLetterOrDigit( characters[ii] ) ) { nonAlphaNumeric = 1; } } } } } return ( uppercase + lowercase + digit + nonAlphaNumeric ) >= categoryCount; } /** * The password does not contain three letter (or more) tokens from the user's account name. * * If the account name is less than three characters long, this check is not performed * because the rate at which passwords would be rejected is too high. For each token that is * three or more characters long, that token is searched for in the password; if it is present, * the password change is rejected. For example, the name "First M. Last" would be split into * three tokens: "First", "M", and "Last". Because the second token is only one character long, * it would be ignored. Therefore, this user could not have a password that included either * "first" or "last" as a substring anywhere in the password. All of these checks are * case-insensitive. */ boolean isValidUsernameSubstring( String username, String password, int tokenSize ) { String[] tokens = username.split( "[^a-zA-Z]" ); for ( int ii = 0; ii < tokens.length; ii++ ) { if ( tokens[ii].length() >= tokenSize ) { if ( password.matches( "(?i).*" + tokens[ii] + ".*" ) ) { return false; } } } return true; } private String buildErrorMessage( String username, String password, int passwordLength, int categoryCount, int tokenSize ) { List<String> violations = new ArrayList<String>(); if ( !isValidPasswordLength( password, passwordLength ) ) { violations.add( "length too short" ); } if ( !isValidCategoryCount( password, categoryCount ) ) { violations.add( "insufficient character mix" ); } if ( !isValidUsernameSubstring( username, password, tokenSize ) ) { violations.add( "contains portions of username" ); } StringBuffer sb = new StringBuffer( "Password violates policy: " ); boolean isFirst = true; for ( String violation : violations ) { if ( isFirst ) { isFirst = false; } else { sb.append( ", " ); } sb.append( violation ); } return sb.toString(); } |
File | Project | Line |
---|---|---|
org/apache/directory/server/kerberos/kdc/authentication/AuthenticationService.java | ApacheDS Protocol Kerberos | 612 |
org/apache/directory/server/kerberos/kdc/ticketgrant/TicketGrantingService.java | ApacheDS Protocol Kerberos | 137 |
try { String clientAddress = kdcContext.getClientAddress().getHostAddress(); StringBuffer sb = new StringBuffer(); sb.append( "Received " + SERVICE_NAME + " request:" ); sb.append( "\n\t" + "messageType: " + request.getMessageType() ); sb.append( "\n\t" + "protocolVersionNumber: " + request.getProtocolVersionNumber() ); sb.append( "\n\t" + "clientAddress: " + clientAddress ); sb.append( "\n\t" + "nonce: " + request.getNonce() ); sb.append( "\n\t" + "kdcOptions: " + request.getKdcOptions() ); sb.append( "\n\t" + "clientPrincipal: " + request.getClientPrincipal() ); sb.append( "\n\t" + "serverPrincipal: " + request.getServerPrincipal() ); sb.append( "\n\t" + "encryptionType: " + KerberosUtils.getEncryptionTypesString( request.getEType() ) ); sb.append( "\n\t" + "realm: " + request.getRealm() ); sb.append( "\n\t" + "from time: " + request.getFrom() ); sb.append( "\n\t" + "till time: " + request.getTill() ); sb.append( "\n\t" + "renew-till time: " + request.getRtime() ); sb.append( "\n\t" + "hostAddresses: " + request.getAddresses() ); LOG.debug( sb.toString() ); } catch ( Exception e ) { // This is a monitor. No exceptions should bubble up. LOG.error( "Error in request monitor", e ); } } |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/interceptor/context/AbstractOperationContext.java | ApacheDS Core | 110 |
org/apache/directory/server/core/interceptor/context/BindOperationContext.java | ApacheDS Core | 238 |
} /** * @return The associated DN */ public LdapDN getDn() { return dn; } /** * Set the context DN * * @param dn The DN to set */ public void setDn( LdapDN dn ) { this.dn = dn; } public void addRequestControl( Control requestControl ) { requestControls.put( requestControl.getID(), requestControl ); } public Control getRequestControl( String numericOid ) { return requestControls.get( numericOid ); } public boolean hasRequestControl( String numericOid ) { return requestControls.containsKey( numericOid ); } public boolean hasRequestControls() { return ! requestControls.isEmpty(); } public void addResponseControl( Control responseControl ) { responseControls.put( responseControl.getID(), responseControl ); } public Control getResponseControl( String numericOid ) { return responseControls.get( numericOid ); } public boolean hasResponseControl( String numericOid ) { return responseControls.containsKey( numericOid ); } public Control[] getResponseControls() { if ( responseControls.isEmpty() ) { return EMPTY_CONTROLS; } return responseControls.values().toArray( EMPTY_CONTROLS ); } public boolean hasResponseControls() { return ! responseControls.isEmpty(); } public int getResponseControlCount() { return responseControls.size(); } public void addRequestControls( Control[] requestControls ) { for ( Control c : requestControls ) { this.requestControls.put( c.getID(), c ); } } /** * Gets the set of bypassed Interceptors. * * @return the set of bypassed Interceptors */ public Collection<String> getByPassed() |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/integ/IntegrationUtils.java | ApacheDS Core Integration | 228 |
org/apache/directory/server/core/unit/IntegrationUtils.java | ApacheDS Core Unit | 135 |
root.modify( dn, entry.getModificationItems() ); break; default: throw new IllegalStateException( "Unidentified change type value: " + entry.getChangeType() ); } } public static LdifEntry getUserAddLdif( String dnstr, byte[] password, String cn, String sn ) throws InvalidNameException, NamingException { LdapDN dn = new LdapDN( dnstr ); LdifEntry ldif = new LdifEntry(); ldif.setDn( dnstr ); ldif.setChangeType( ChangeType.Add ); EntryAttribute attr = new DefaultClientAttribute( "objectClass", "top", "person", "organizationalPerson", "inetOrgPerson" ); ldif.addAttribute( attr ); attr = new DefaultClientAttribute( "ou", "Engineering", "People" ); ldif.addAttribute( attr ); String uid = ( String ) dn.getRdn().getValue(); ldif.putAttribute( "uid", uid ); ldif.putAttribute( "l", "Bogusville" ); ldif.putAttribute( "cn", cn ); ldif.putAttribute( "sn", sn ); ldif.putAttribute( "mail", uid + "@apache.org" ); ldif.putAttribute( "telephoneNumber", "+1 408 555 4798" ); ldif.putAttribute( "facsimileTelephoneNumber", "+1 408 555 9751" ); ldif.putAttribute( "roomnumber", "4612" ); ldif.putAttribute( "userPassword", password ); String givenName = cn.split( " " )[0]; ldif.putAttribute( "givenName", givenName ); return ldif; } } |
File | Project | Line |
---|---|---|
org/apache/directory/server/kerberos/kdc/authentication/AuthenticationService.java | ApacheDS Protocol Kerberos | 698 |
org/apache/directory/server/kerberos/kdc/ticketgrant/TicketGrantingService.java | ApacheDS Protocol Kerberos | 496 |
if ( reply instanceof KdcReply ) { KdcReply success = ( KdcReply ) reply; try { StringBuffer sb = new StringBuffer(); sb.append( "Responding with " + SERVICE_NAME + " reply:" ); sb.append( "\n\t" + "messageType: " + success.getMessageType() ); sb.append( "\n\t" + "protocolVersionNumber: " + success.getProtocolVersionNumber() ); sb.append( "\n\t" + "nonce: " + success.getNonce() ); sb.append( "\n\t" + "clientPrincipal: " + success.getClientPrincipal() ); sb.append( "\n\t" + "client realm: " + success.getClientRealm() ); sb.append( "\n\t" + "serverPrincipal: " + success.getServerPrincipal() ); sb.append( "\n\t" + "server realm: " + success.getServerRealm() ); sb.append( "\n\t" + "auth time: " + success.getAuthTime() ); sb.append( "\n\t" + "start time: " + success.getStartTime() ); sb.append( "\n\t" + "end time: " + success.getEndTime() ); sb.append( "\n\t" + "renew-till time: " + success.getRenewTill() ); sb.append( "\n\t" + "hostAddresses: " + success.getClientAddresses() ); LOG.debug( sb.toString() ); } catch ( Exception e ) { // This is a monitor. No exceptions should bubble up. LOG.error( "Error in reply monitor", e ); } } } |
File | Project | Line |
---|---|---|
org/apache/directory/server/tools/CapacityTestCommand.java | ApacheDS Server Tools | 185 |
org/apache/directory/server/tools/ImportCommand.java | ApacheDS Server Tools | 760 |
System.out.println( "ignore-errors set to default: false" ); } // ------------------------------------------------------------------- // figure out and error check the port value // ------------------------------------------------------------------- if ( cmd.hasOption( 'p' ) ) // - user provided port w/ -p takes // precedence { String val = cmd.getOptionValue( 'p' ); try { port = Integer.parseInt( val ); } catch ( NumberFormatException e ) { System.err.println( "port value of '" + val + "' is not a number" ); System.exit( 1 ); } if ( port > AvailablePortFinder.MAX_PORT_NUMBER ) { System.err.println( "port value of '" + val + "' is larger than max port number: " + AvailablePortFinder.MAX_PORT_NUMBER ); System.exit( 1 ); } else if ( port < AvailablePortFinder.MIN_PORT_NUMBER ) { System.err.println( "port value of '" + val + "' is smaller than the minimum port number: " + AvailablePortFinder.MIN_PORT_NUMBER ); System.exit( 1 ); } if ( isDebugEnabled() ) { System.out.println( "port overriden by -p option: " + port ); } } else if ( getApacheDS() != null ) { port = getApacheDS().getLdapService().getIpPort(); if ( isDebugEnabled() ) { System.out.println( "port overriden by server.xml configuration: " + port ); } } else if ( isDebugEnabled() ) { System.out.println( "port set to default: " + port ); } // ------------------------------------------------------------------- // figure out the user value // ------------------------------------------------------------------- if ( cmd.hasOption( 'u' ) ) |
File | Project | Line |
---|---|---|
jdbm/helper/ByteArrayComparator.java | ApacheDS JDBM implementation | 87 |
jdbm/helper/ObjectBAComparator.java | ApacheDS JDBM implementation | 119 |
} /** * Compare two byte arrays. */ public static int compareByteArray( byte[] thisKey, byte[] otherKey ) { int len = Math.min( thisKey.length, otherKey.length ); // compare the byte arrays for ( int i=0; i<len; i++ ) { if ( thisKey[i] >= 0 ) { if ( otherKey[i] >= 0 ) { // both positive if ( thisKey[i] < otherKey[i] ) { return -1; } else if ( thisKey[i] > otherKey[i] ) { return 1; } } else { // otherKey is negative => greater (because MSB is 1) return -1; } } else { if ( otherKey[i] >= 0 ) { // thisKey is negative => greater (because MSB is 1) return 1; } else { // both negative if ( thisKey[i] < otherKey[i] ) { return -1; } else if ( thisKey[i] > otherKey[i] ) { return 1; } } } } if ( thisKey.length == otherKey.length) { return 0; } if ( thisKey.length < otherKey.length ) { return -1; } return 1; } } |
File | Project | Line |
---|---|---|
org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java | ApacheDS Generalized (X) DBM Search Engine | 196 |
org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java | ApacheDS Generalized (X) DBM Search Engine | 193 |
} public boolean evaluate( ServerEntry entry ) throws Exception { // get the attribute ServerAttribute attr = ( ServerAttribute ) entry.get( type ); // if the attribute does not exist just return false if ( attr != null && evaluate( null, attr ) ) { return true; } // If we do not have the attribute, loop through the sub classes of // the attributeType. Perhaps the entry has an attribute value of a // subtype (descendant) that will produce a match if ( registries.getAttributeTypeRegistry().hasDescendants( node.getAttribute() ) ) { // TODO check to see if descendant handling is necessary for the // index so we can match properly even when for example a name // attribute is used instead of more specific commonName Iterator<AttributeType> descendants = registries.getAttributeTypeRegistry().descendants( node.getAttribute() ); while ( descendants.hasNext() ) { AttributeType descendant = descendants.next(); attr = ( ServerAttribute ) entry.get( descendant ); if ( attr != null && evaluate( null, attr ) ) { return true; } } } // we fell through so a match was not found - assertion was false. return false; } // TODO - determine if comaparator and index entry should have the Value // wrapper or the raw normalized value private boolean evaluate( IndexEntry<Object,ServerEntry> indexEntry, ServerAttribute attribute ) throws Exception { /* * Cycle through the attribute values testing normalized version * obtained from using the ordering or equality matching rule's * normalizer. The test uses the comparator obtained from the * appropriate matching rule to perform the check. */ for ( Value value : attribute ) { value.normalize( normalizer ); //noinspection unchecked if ( comparator.compare( value.getNormalizedValue(), node.getValue().getNormalizedValue() ) <= 0 ) |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/integ/state/TestServiceContext.java | ApacheDS Core Integration | 209 |
org/apache/directory/server/integ/state/TestServerContext.java | ApacheDS Server Integration | 210 |
field.set( testClass.getJavaClass(), get().getLdapServer() ); new MethodRoadie( test, testMethod, notifier, description ).run(); } catch ( InvocationTargetException e ) { LOG.error( "Failed to invoke test method: " + description.getDisplayName(), e.getCause() ); notifier.testAborted( description, e.getCause() ); return; } catch ( InstantiationException ie ) { LOG.error( "Failed to invoke test method: " + description.getDisplayName(), ie ); notifier.testAborted( description, ie ); return; } catch ( IllegalAccessException iae ) { LOG.error( "Failed to invoke test method: " + description.getDisplayName(), iae ); notifier.testAborted( description, iae ); return; } catch ( NoSuchMethodException nsme ) { LOG.error( "Failed to invoke test method: " + description.getDisplayName(), nsme ); notifier.testAborted( description, nsme ); return; } catch ( NoSuchFieldException nsfe ) { LOG.error( "Failed to invoke test method: " + description.getDisplayName(), nsfe ); notifier.testAborted( description, nsfe ); return; } } // ----------------------------------------------------------------------- // Package Friendly Instance Methods // ----------------------------------------------------------------------- void setState( TestServerState state ) |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/DefaultDirectoryService.java | ApacheDS Core | 1395 |
org/apache/directory/server/core/configuration/AttributesPropertyEditor.java | ApacheDS Core | 103 |
} } /** * Read an entry (without DN) * * @param text The ldif format file * @return An entry. */ private Entry readEntry( String text ) { StringReader strIn = new StringReader( text ); BufferedReader in = new BufferedReader( strIn ); String line = null; Entry entry = new DefaultClientEntry(); try { while ( ( line = in.readLine() ) != null ) { if ( line.length() == 0 ) { continue; } String addedLine = line.trim(); if ( StringTools.isEmpty( addedLine ) ) { continue; } EntryAttribute attribute = AttributeUtils.toClientAttribute( LdifReader.parseAttributeValue( addedLine ) ); EntryAttribute oldAttribute = entry.get( attribute.getId() ); if ( oldAttribute != null ) { try { oldAttribute.add( attribute.get() ); entry.put( oldAttribute ); } catch (NamingException ne) { // Do nothing } } else { try { entry.put( attribute ); } catch ( NamingException ne ) { // Do nothing... } } } } catch (IOException ioe) { // Do nothing : we can't reach this point ! } return entry; } /** * Converts the specified LDIF string into {@link Attributes}. */ public void setAsText( String text ) throws IllegalArgumentException |
File | Project | Line |
---|---|---|
org/apache/directory/server/ldap/handlers/ReferralAwareRequestHandler.java | ApacheDS Protocol Ldap | 604 |
org/apache/directory/server/ldap/handlers/ReferralAwareRequestHandler.java | ApacheDS Protocol Ldap | 703 |
public Referral getReferralOnAncestorForSearch( LdapSession session, SearchRequest req, ClonedServerEntry referralAncestor ) throws Exception { LOG.debug( "Inside getReferralOnAncestor()" ); ServerAttribute refAttr = ( ServerAttribute ) referralAncestor.getOriginalEntry() .get( SchemaConstants.REF_AT ); Referral referral = new ReferralImpl(); for ( Value<?> value : refAttr ) { String ref = ( String ) value.get(); LOG.debug( "Calculating LdapURL for referrence value {}", ref ); // need to add non-ldap URLs as-is if ( ! ref.startsWith( "ldap" ) ) { referral.addLdapUrl( ref ); continue; } // Parse the ref value LdapURL ldapUrl = new LdapURL(); try { ldapUrl.parse( ref.toCharArray() ); } catch ( LdapURLEncodingException e ) { LOG.error( "Bad URL ({}) for ref in {}. Reference will be ignored.", ref, referralAncestor ); } // Normalize the DN to check for same dn LdapDN urlDn = new LdapDN( ldapUrl.getDn().getUpName() ); urlDn.normalize( session.getCoreSession().getDirectoryService().getRegistries() .getAttributeTypeRegistry().getNormalizerMapping() ); if ( urlDn.getNormName().equals( req.getBase().getNormName() ) ) |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/subtree/SubentryInterceptor.java | ApacheDS Core | 852 |
org/apache/directory/server/core/subtree/SubentryInterceptor.java | ApacheDS Core | 926 |
ExprNode filter = new PresenceNode( SchemaConstants.OBJECT_CLASS_AT ); SearchControls controls = new SearchControls(); controls.setSearchScope( SearchControls.SUBTREE_SCOPE ); controls.setReturningAttributes( new String[] { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES } ); EntryFilteringCursor subentries = nexus.search( new SearchOperationContext( opContext.getSession(), baseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) ); while ( subentries.next() ) { ServerEntry candidate = subentries.get(); LdapDN dn = candidate.getDn(); dn.normalize( atRegistry.getNormalizerMapping() ); if ( evaluator.evaluate( ss, apName, dn, candidate ) ) { nexus.modify( new ModifyOperationContext( opContext.getSession(), dn, getOperationalModsForReplace( oriChildName, newName, subentry, candidate ) ) ); } } } else { if ( hasAdministrativeDescendant( opContext, oriChildName ) ) { String msg = "Will not allow rename operation on entries with administrative descendants."; LOG.warn( msg ); throw new LdapSchemaViolationException( msg, ResultCodeEnum.NOT_ALLOWED_ON_RDN ); } next.move( opContext ); |
File | Project | Line |
---|---|---|
org/apache/directory/server/xdbm/search/impl/AndCursor.java | ApacheDS Generalized (X) DBM Search Engine | 171 |
org/apache/directory/server/xdbm/search/impl/AndEvaluator.java | ApacheDS Generalized (X) DBM Search Engine | 51 |
this.evaluators = optimize( evaluators ); } /** * Takes a set of Evaluators and copies then sorts them in a new list with * increasing scan counts on their expression nodes. This is done to have * the Evaluators with the least scan count which have the highest * probability of rejecting a candidate first. That will increase the * chance of shorting the checks on evaluators early so extra lookups and * comparisons are avoided. * * @param unoptimized the unoptimized list of Evaluators * @return optimized Evaluator list with increasing scan count ordering */ private List<Evaluator<? extends ExprNode,ServerEntry>> optimize( List<Evaluator<? extends ExprNode,ServerEntry>> unoptimized ) { List<Evaluator<? extends ExprNode,ServerEntry>> optimized = new ArrayList<Evaluator<? extends ExprNode,ServerEntry>>( unoptimized.size() ); optimized.addAll( unoptimized ); Collections.sort( optimized, new Comparator<Evaluator<?,ServerEntry>>() { public int compare( Evaluator<?, ServerEntry> e1, Evaluator<?, ServerEntry> e2 ) { long scanCount1 = ( Long ) e1.getExpression().get( "count" ); long scanCount2 = ( Long ) e2.getExpression().get( "count" ); if ( scanCount1 == scanCount2 ) { return 0; } /* * We want the Evaluator with the smallest scan count first * since this node has the highest probability of failing, or * rather the least probability of succeeding. That way we * can short the sub-expression evaluation process. */ if ( scanCount1 < scanCount2 ) { return -1; } return 1; } }); return optimized; } |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/schema/MetaComparatorHandler.java | ApacheDS Core | 88 |
org/apache/directory/server/core/schema/PartitionSchemaLoader.java | ApacheDS Core | 814 |
targetRegistries.getComparatorRegistry().register( comparatorDescription, comparator ); } } private ComparatorDescription getComparatorDescription( String schemaName, ServerEntry entry ) throws Exception { ComparatorDescription description = new ComparatorDescription(); description.setNumericOid( getOid( entry ) ); List<String> values = new ArrayList<String>(); values.add( schemaName ); description.addExtension( MetaSchemaConstants.X_SCHEMA, values ); description.setFqcn( entry.get( fqcnAT ).getString() ); EntryAttribute desc = entry.get( descAT ); if ( desc != null && desc.size() > 0 ) { description.setDescription( desc.getString() ); } EntryAttribute bytecode = entry.get( byteCodeAT ); if ( bytecode != null && bytecode.size() > 0 ) { byte[] bytes = bytecode.getBytes(); description.setBytecode( new String( Base64.encode( bytes ) ) ); } return description; } |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/partition/impl/btree/gui/AddEntryDialog.java | ApacheDS Core | 153 |
org/apache/directory/server/core/partition/impl/btree/gui/EntryDialog.java | ApacheDS Core | 140 |
m_attrTbl.setEditingColumn( 1 ); m_attrTbl.setCellSelectionEnabled( true ); m_doneBut.setText( "Done" ); m_buttonPnl.setLayout( new java.awt.FlowLayout( java.awt.FlowLayout.RIGHT, 10, 5 ) ); m_buttonPnl.add( m_doneBut ); m_buttonPnl.add( m_cancelBut ); m_cancelBut.setText( "Cancel" ); m_cancelBut.addActionListener( new ActionListener() { public void actionPerformed( ActionEvent a_evt ) { closeDialog(); } } ); m_attrScrollPnl.setBorder( javax.swing.BorderFactory.createTitledBorder( javax.swing.BorderFactory .createLineBorder( new java.awt.Color( 153, 153, 153 ), 1 ), "Attributes", javax.swing.border.TitledBorder.LEADING, javax.swing.border.TitledBorder.TOP, new java.awt.Font( "SansSerif", 0, 14 ), new java.awt.Color( 60, 60, 60 ) ) ); |
File | Project | Line |
---|---|---|
org/apache/directory/server/kerberos/protocol/KerberosProtocolHandler.java | ApacheDS Protocol Kerberos | 97 |
org/apache/directory/server/ntp/protocol/NtpProtocolHandler.java | ApacheDS Protocol Ntp | 55 |
} public void sessionOpened( IoSession session ) { if ( log.isDebugEnabled() ) { log.debug( "{} OPENED", session.getRemoteAddress() ); } } public void sessionClosed( IoSession session ) { if ( log.isDebugEnabled() ) { log.debug( "{} CLOSED", session.getRemoteAddress() ); } } public void sessionIdle( IoSession session, IdleStatus status ) { if ( log.isDebugEnabled() ) { log.debug( "{} IDLE ({})", session.getRemoteAddress(), status ); } } public void exceptionCaught( IoSession session, Throwable cause ) { log.error( session.getRemoteAddress() + " EXCEPTION", cause ); session.close(); } public void messageReceived( IoSession session, Object message ) { if ( log.isDebugEnabled() ) { log.debug( "{} RCVD: {}", session.getRemoteAddress(), message ); } |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/partition/impl/btree/gui/AnnotatedFilterTreeDialog.java | ApacheDS Core | 56 |
org/apache/directory/server/core/partition/impl/btree/gui/SearchResultDialog.java | ApacheDS Core | 65 |
public SearchResultDialog(Frame parent, boolean modal) { super( parent, modal ); initGUI(); } /** * This method is called from within the constructor to initialize the form. */ private void initGUI() { addWindowListener( new java.awt.event.WindowAdapter() { public void windowClosing( java.awt.event.WindowEvent evt ) { closeDialog( evt ); } } ); pack(); getContentPane().setLayout( new java.awt.GridBagLayout() ); getContentPane().add( jPanel1, new java.awt.GridBagConstraints( 0, 0, 1, 1, 1.0, 0.1, java.awt.GridBagConstraints.NORTH, java.awt.GridBagConstraints.BOTH, new java.awt.Insets( 10, 5, 5, 5 ), 0, 0 ) ); getContentPane().add( jPanel2, new java.awt.GridBagConstraints( 0, 1, 1, 1, 1.0, 0.4, java.awt.GridBagConstraints.CENTER, |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/authn/SimpleAuthenticator.java | ApacheDS Core | 109 |
org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java | ApacheDS Interceptors for Kerberos | 100 |
private static final Collection<String> USERLOOKUP_BYPASS; static { Set<String> c = new HashSet<String>(); c.add( NormalizationInterceptor.class.getName() ); c.add( AuthenticationInterceptor.class.getName() ); c.add( AciAuthorizationInterceptor.class.getName() ); c.add( DefaultAuthorizationInterceptor.class.getName() ); c.add( ExceptionInterceptor.class.getName() ); c.add( OperationalAttributeInterceptor.class.getName() ); c.add( SchemaInterceptor.class.getName() ); c.add( SubentryInterceptor.class.getName() ); c.add( CollectiveAttributeInterceptor.class.getName() ); c.add( EventInterceptor.class.getName() ); c.add( TriggerInterceptor.class.getName() ); USERLOOKUP_BYPASS = Collections.unmodifiableCollection( c ); } /** * Intercept the addition of the 'userPassword' and 'krb5PrincipalName' attributes. Use the 'userPassword' * and 'krb5PrincipalName' attributes to derive Kerberos keys for the principal. If the 'userPassword' is * the special keyword 'randomKey', set random keys for the principal. Set the key version number (kvno) * to '0'. */ public void add( NextInterceptor next, AddOperationContext addContext ) throws Exception |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/schema/MetaSyntaxCheckerHandler.java | ApacheDS Core | 74 |
org/apache/directory/server/core/schema/PartitionSchemaLoader.java | ApacheDS Core | 844 |
} private SyntaxCheckerDescription getSyntaxCheckerDescription( String schemaName, ServerEntry entry ) throws Exception { SyntaxCheckerDescription description = new SyntaxCheckerDescription(); description.setNumericOid( getOid( entry ) ); List<String> values = new ArrayList<String>(); values.add( schemaName ); description.addExtension( MetaSchemaConstants.X_SCHEMA, values ); description.setFqcn( entry.get( fqcnAT ).getString() ); EntryAttribute desc = entry.get( descAT ); if ( desc != null && desc.size() > 0 ) { description.setDescription( desc.getString() ); } EntryAttribute bytecode = entry.get( byteCodeAT ); if ( bytecode != null && bytecode.size() > 0 ) { byte[] bytes = bytecode.getBytes(); description.setBytecode( new String( Base64.encode( bytes ) ) ); } return description; } |
File | Project | Line |
---|---|---|
org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java | ApacheDS Generalized (X) DBM Search Engine | 128 |
org/apache/directory/server/xdbm/search/impl/EqualityCursor.java | ApacheDS Generalized (X) DBM Search Engine | 127 |
userIdxCursor.afterValue( id, key ); } else { throw new UnsupportedOperationException( UNSUPPORTED_MSG ); } } public void after( IndexEntry<V, ServerEntry> element ) throws Exception { checkNotClosed( "after()" ); if ( userIdxCursor != null ) { userIdxCursor.after( element ); } else { throw new UnsupportedOperationException( UNSUPPORTED_MSG ); } } public void beforeFirst() throws Exception { checkNotClosed( "beforeFirst()" ); if ( userIdxCursor != null ) { userIdxCursor.beforeFirst(); } else { ndnIdxCursor.beforeFirst(); available = false; } } public void afterLast() throws Exception { checkNotClosed( "afterLast()" ); if ( userIdxCursor != null ) { userIdxCursor.afterLast(); } else { ndnIdxCursor.afterLast(); available = false; } } public boolean first() throws Exception { beforeFirst(); return next(); } public boolean last() throws Exception { afterLast(); return previous(); } |
File | Project | Line |
---|---|---|
org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java | ApacheDS Generalized (X) DBM Search Engine | 95 |
org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java | ApacheDS Generalized (X) DBM Search Engine | 119 |
} public boolean evaluate( ServerEntry entry ) throws Exception { // get the attribute ServerAttribute attr = ( ServerAttribute ) entry.get( type ); // if the attribute does not exist just return false if ( attr != null && evaluate( attr ) ) { return true; } // If we do not have the attribute, loop through the sub classes of // the attributeType. Perhaps the entry has an attribute value of a // subtype (descendant) that will produce a match if ( registries.getAttributeTypeRegistry().hasDescendants( node.getAttribute() ) ) { // TODO check to see if descendant handling is necessary for the // index so we can match properly even when for example a name // attribute is used instead of more specific commonName Iterator<AttributeType> descendants = registries.getAttributeTypeRegistry().descendants( node.getAttribute() ); while ( descendants.hasNext() ) { AttributeType descendant = descendants.next(); attr = ( ServerAttribute ) entry.get( descendant ); if ( attr != null && evaluate( attr ) ) { return true; } } } // we fell through so a match was not found - assertion was false. return false; } public boolean evaluate( Long id ) throws Exception { if ( idx != null ) { return idx.reverse( id ); } return evaluate ( db.lookup( id ) ); } |
File | Project | Line |
---|---|---|
org/apache/directory/server/kerberos/shared/crypto/encryption/AesCtsSha1Encryption.java | ApacheDS Protocol Kerberos Shared | 87 |
org/apache/directory/server/kerberos/shared/crypto/encryption/Des3CbcSha1KdEncryption.java | ApacheDS Protocol Kerberos Shared | 94 |
byte[] Ke = deriveKey( key.getKeyValue(), getUsageKe( usage ), 64, 168 ); byte[] encryptedData = data.getCipher(); // extract the old checksum byte[] oldChecksum = new byte[getChecksumLength()]; System .arraycopy( encryptedData, encryptedData.length - getChecksumLength(), oldChecksum, 0, oldChecksum.length ); // remove trailing checksum encryptedData = removeTrailingBytes( encryptedData, 0, getChecksumLength() ); // decrypt the data byte[] decryptedData = decrypt( encryptedData, Ke ); // remove leading confounder byte[] withoutConfounder = removeLeadingBytes( decryptedData, getConfounderLength(), 0 ); // calculate a new checksum byte[] newChecksum = calculateIntegrity( decryptedData, key.getKeyValue(), usage ); // compare checksums if ( !Arrays.equals( oldChecksum, newChecksum ) ) { throw new KerberosException( ErrorType.KRB_AP_ERR_BAD_INTEGRITY ); } return withoutConfounder; } public EncryptedData getEncryptedData( EncryptionKey key, byte[] plainText, KeyUsage usage ) { byte[] Ke = deriveKey( key.getKeyValue(), getUsageKe( usage ), 64, 168 ); |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/schema/SchemaPartitionDao.java | ApacheDS Core | 270 |
org/apache/directory/server/core/schema/SchemaPartitionDao.java | ApacheDS Core | 316 |
new ClientStringValue( MetaSchemaConstants.META_OBJECT_CLASS_OC ) ) ); if ( NUMERIC_OID_CHECKER.isValidSyntax( oid ) ) { filter.addNode( new EqualityNode<String>( M_OID_OID, new ClientStringValue( oid ) ) ); } else { filter.addNode( new EqualityNode<String>( M_NAME_OID, new ClientStringValue( oid.toLowerCase() ) ) ); } SearchControls searchControls = new SearchControls(); searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE ); EntryFilteringCursor cursor = null; try { cursor = partition.search( new SearchOperationContext( null, partition.getSuffixDn(), AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) ); if ( !cursor.next() ) { return false; } if ( cursor.next() ) { throw new NamingException( "Got more than one attributeType for oid of " + oid ); } return true; } finally { if ( cursor != null ) { cursor.close(); } } } public boolean hasSyntax( String oid ) throws Exception |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/trigger/TriggerInterceptor.java | ApacheDS Core | 427 |
org/apache/directory/server/core/trigger/TriggerInterceptor.java | ApacheDS Core | 502 |
opContext, false, oldRDN, newRDN, oldSuperiorDN, newSuperiorDN, oldDN, newDN ); // Gather Trigger Specifications which apply to the entry being exported. List<TriggerSpecification> exportTriggerSpecs = new ArrayList<TriggerSpecification>(); addPrescriptiveTriggerSpecs( opContext, exportTriggerSpecs, oriChildName, movedEntry ); addEntryTriggerSpecs( exportTriggerSpecs, movedEntry ); // Get the entry again without operational attributes // because access control subentry operational attributes // will not be valid at the new location. // This will certainly be fixed by the SubentryInterceptor, // but after this service. ClonedServerEntry importedEntry = opContext.lookup( oriChildName, ByPassConstants.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS ); // As the target entry does not exist yet and so // its subentry operational attributes are not there, // we need to construct an entry to represent it // at least with minimal requirements which are object class // and access control subentry operational attributes. SubentryInterceptor subentryInterceptor = ( SubentryInterceptor ) chain.get( SubentryInterceptor.class.getName() ); ServerEntry fakeImportedEntry = subentryInterceptor.getSubentryAttributes( newDN, importedEntry ); for ( EntryAttribute attribute:importedEntry ) { fakeImportedEntry.put( attribute ); } // Gather Trigger Specifications which apply to the entry being imported. // Note: Entry Trigger Specifications are not valid for Import. List<TriggerSpecification> importTriggerSpecs = new ArrayList<TriggerSpecification>(); addPrescriptiveTriggerSpecs( opContext, importTriggerSpecs, newDN, fakeImportedEntry ); Map<ActionTime, List<TriggerSpecification>> exportTriggerMap = getActionTimeMappedTriggerSpecsForOperation( exportTriggerSpecs, LdapOperation.MODIFYDN_EXPORT ); Map<ActionTime, List<TriggerSpecification>> importTriggerMap = getActionTimeMappedTriggerSpecsForOperation( importTriggerSpecs, LdapOperation.MODIFYDN_IMPORT ); next.move( opContext ); |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/subtree/SubentryInterceptor.java | ApacheDS Core | 772 |
org/apache/directory/server/core/subtree/SubentryInterceptor.java | ApacheDS Core | 848 |
next.moveAndRename( opContext ); subentry = subentryCache.getSubentry( newNormName ); ExprNode filter = new PresenceNode( oidRegistry.getOid( SchemaConstants.OBJECT_CLASS_AT ) ); SearchControls controls = new SearchControls(); controls.setSearchScope( SearchControls.SUBTREE_SCOPE ); controls.setReturningAttributes( new String[] { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES } ); EntryFilteringCursor subentries = nexus.search( new SearchOperationContext( opContext.getSession(), baseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) ); while ( subentries.next() ) { ServerEntry candidate = subentries.get(); LdapDN dn = candidate.getDn(); dn.normalize( atRegistry.getNormalizerMapping() ); if ( evaluator.evaluate( ss, apName, dn, candidate ) ) { nexus.modify( new ModifyOperationContext( opContext.getSession(), dn, getOperationalModsForReplace( oriChildName, newName, subentry, candidate ) ) ); |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/interceptor/context/AbstractOperationContext.java | ApacheDS Core | 329 |
org/apache/directory/server/core/interceptor/context/BindOperationContext.java | ApacheDS Core | 393 |
return session.getDirectoryService().getOperationManager().lookup( opContext ); } public ClonedServerEntry lookup( LdapDN dn, Collection<String> byPassed ) throws Exception { LookupOperationContext opContext = newLookupContext( dn ); opContext.setByPassed( byPassed ); return session.getDirectoryService().getOperationManager().lookup( opContext ); } public LdapPrincipal getEffectivePrincipal() { if ( authorizedPrincipal != null ) { return authorizedPrincipal; } return session.getEffectivePrincipal(); } // ----------------------------------------------------------------------- // OperationContext Linked List Methods // ----------------------------------------------------------------------- public boolean isFirstOperation() { return previous == null; } public OperationContext getFirstOperation() { if ( previous == null ) { return this; } return previous.getFirstOperation(); } public OperationContext getLastOperation() { if ( next == null ) { return this; } return next.getLastOperation(); } public OperationContext getNextOperation() { return next; } |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/integ/CiRunner.java | ApacheDS Core Integration | 65 |
org/apache/directory/server/integ/SiRunner.java | ApacheDS Server Integration | 67 |
settings = new InheritableServerSettings( getDescription(), null ); } return settings; } @Override public void run( final RunNotifier notifier ) { super.run( notifier ); Level cleanupLevel = getSettings().getCleanupLevel(); if ( cleanupLevel == Level.CLASS ) { try { shutdown(); cleanup(); destroy(); } catch ( Exception e ) { LOG.error( "Encountered exception while trying to cleanup after test class: " + this.getDescription().getDisplayName(), e ); notifier.fireTestFailure( new Failure( getDescription(), e ) ); } } } @Override protected void invokeTestMethod( Method method, final RunNotifier notifier ) { LOG.debug( "About to invoke test method {}", method.getName() ); Description description = methodDescription( method ); test( getTestClass(), wrapMethod( method ), notifier, new InheritableServerSettings( description, getSettings() ) ); |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/schema/MetaComparatorHandler.java | ApacheDS Core | 95 |
org/apache/directory/server/core/schema/PartitionSchemaLoader.java | ApacheDS Core | 850 |
SyntaxCheckerDescription description = new SyntaxCheckerDescription(); description.setNumericOid( getOid( entry ) ); List<String> values = new ArrayList<String>(); values.add( schemaName ); description.addExtension( MetaSchemaConstants.X_SCHEMA, values ); description.setFqcn( entry.get( fqcnAT ).getString() ); EntryAttribute desc = entry.get( descAT ); if ( desc != null && desc.size() > 0 ) { description.setDescription( desc.getString() ); } EntryAttribute bytecode = entry.get( byteCodeAT ); if ( bytecode != null && bytecode.size() > 0 ) { byte[] bytes = bytecode.getBytes(); description.setBytecode( new String( Base64.encode( bytes ) ) ); } return description; } public void loadWithDependencies( Schema schema, Registries registries ) throws Exception |
File | Project | Line |
---|---|---|
org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java | ApacheDS Generalized (X) DBM Search Engine | 227 |
org/apache/directory/server/xdbm/search/impl/EqualityCursor.java | ApacheDS Generalized (X) DBM Search Engine | 228 |
if ( equalityEvaluator.evaluate( candidate ) ) { return available = true; } } return available = false; } @SuppressWarnings("unchecked") public IndexEntry<V, ServerEntry> get() throws Exception { checkNotClosed( "get()" ); if ( userIdxCursor != null ) { return userIdxCursor.get(); } if ( available ) { return ( IndexEntry<V, ServerEntry> )ndnIdxCursor.get(); } throw new InvalidCursorPositionException( "Cursor has not been positioned yet." ); } public boolean isElementReused() { if ( userIdxCursor != null ) { return userIdxCursor.isElementReused(); } return ndnIdxCursor.isElementReused(); } public void close() throws Exception { super.close(); if ( userIdxCursor != null ) { userIdxCursor.close(); } else { ndnIdxCursor.close(); } } } |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/schema/PartitionSchemaLoader.java | ApacheDS Core | 754 |
org/apache/directory/server/core/schema/PartitionSchemaLoader.java | ApacheDS Core | 821 |
ComparatorDescription description = new ComparatorDescription(); description.setNumericOid( getOid( entry ) ); List<String> values = new ArrayList<String>(); values.add( schemaName ); description.addExtension( MetaSchemaConstants.X_SCHEMA, values ); description.setFqcn( entry.get( fqcnAT ).getString() ); EntryAttribute desc = entry.get( descAT ); if ( desc != null && desc.size() > 0 ) { description.setDescription( desc.getString() ); } EntryAttribute bytecode = entry.get( byteCodeAT ); if ( bytecode != null && bytecode.size() > 0 ) { byte[] bytes = bytecode.getBytes(); description.setBytecode( new String( Base64.encode( bytes ) ) ); } return description; } private SyntaxCheckerDescription getSyntaxCheckerDescription( String schemaName, ServerEntry entry ) |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/schema/MetaComparatorHandler.java | ApacheDS Core | 95 |
org/apache/directory/server/core/schema/PartitionSchemaLoader.java | ApacheDS Core | 754 |
NormalizerDescription description = new NormalizerDescription(); description.setNumericOid( getOid( entry ) ); List<String> values = new ArrayList<String>(); values.add( schemaName ); description.addExtension( MetaSchemaConstants.X_SCHEMA, values ); description.setFqcn( entry.get( fqcnAT ).getString() ); EntryAttribute desc = entry.get( descAT ); if ( desc != null && desc.size() > 0 ) { description.setDescription( desc.getString() ); } EntryAttribute bytecode = entry.get( byteCodeAT ); if ( bytecode != null && bytecode.size() > 0 ) { byte[] bytes = bytecode.getBytes(); description.setBytecode( new String( Base64.encode( bytes ) ) ); } return description; } |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/partition/impl/btree/gui/AnnotatedFilterTreeDialog.java | ApacheDS Core | 97 |
org/apache/directory/server/core/partition/impl/btree/gui/SearchResultDialog.java | ApacheDS Core | 113 |
setTitle( "Search Results" ); jPanel2.setLayout( new java.awt.BorderLayout() ); jPanel2.setBorder( javax.swing.BorderFactory.createTitledBorder( javax.swing.BorderFactory.createLineBorder( new java.awt.Color( 153, 153, 153 ), 1 ), "Filter Expression Tree", javax.swing.border.TitledBorder.LEADING, javax.swing.border.TitledBorder.TOP, new java.awt.Font( "SansSerif", 0, 14 ), new java.awt.Color( 60, 60, 60 ) ) ); jPanel2.add( jScrollPane1, java.awt.BorderLayout.CENTER ); jButton1.setText( "Done" ); jButton1.setActionCommand( "Done" ); jButton1.addActionListener( new ActionListener() { public void actionPerformed( ActionEvent event ) |
File | Project | Line |
---|---|---|
org/apache/directory/server/kerberos/shared/crypto/encryption/DesStringToKey.java | ApacheDS Protocol Kerberos Shared | 139 |
org/apache/directory/server/kerberos/shared/crypto/encryption/EncryptionEngine.java | ApacheDS Protocol Kerberos Shared | 185 |
} protected int getBit( byte[] data, int pos ) { int posByte = pos / 8; int posBit = pos % 8; byte valByte = data[posByte]; int valInt = valByte >> ( 8 - ( posBit + 1 ) ) & 0x0001; return valInt; } protected void setBit( byte[] data, int pos, int val ) { int posByte = pos / 8; int posBit = pos % 8; byte oldByte = data[posByte]; oldByte = ( byte ) ( ( ( 0xFF7F >> posBit ) & oldByte ) & 0x00FF ); byte newByte = ( byte ) ( ( val << ( 8 - ( posBit + 1 ) ) ) | oldByte ); data[posByte] = newByte; } /** * The "well-known constant" used for the DK function is the key * usage number, expressed as four octets in big-endian order, * followed by one octet indicated below. * * Kc = DK(base-key, usage | 0x99); */ protected byte[] getUsageKc( KeyUsage usage ) |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/schema/MetaDitContentRuleHandler.java | ApacheDS Core | 41 |
org/apache/directory/server/core/schema/MetaNameFormHandler.java | ApacheDS Core | 41 |
protected MetaNameFormHandler( Registries targetRegistries, PartitionSchemaLoader loader ) throws Exception { super( targetRegistries, loader ); // TODO Auto-generated constructor stub } /* (non-Javadoc) * @see org.apache.directory.server.core.schema.AbstractSchemaChangeHandler#modify( * org.apache.directory.shared.ldap.name.LdapDN, javax.naming.directory.Attributes, * javax.naming.directory.Attributes) */ @Override protected void modify( LdapDN name, ServerEntry entry, ServerEntry targetEntry, boolean cascade ) throws NamingException { // TODO Auto-generated method stub } /* (non-Javadoc) * @see org.apache.directory.server.core.schema.SchemaChangeHandler#add( * org.apache.directory.shared.ldap.name.LdapDN, javax.naming.directory.Attributes) */ public void add( LdapDN name, ServerEntry entry ) throws NamingException { // TODO Auto-generated method stub } /* (non-Javadoc) * @see org.apache.directory.server.core.schema.SchemaChangeHandler#delete( * org.apache.directory.shared.ldap.name.LdapDN, javax.naming.directory.Attributes) */ public void delete( LdapDN name, ServerEntry entry, boolean cascade ) throws NamingException { // TODO Auto-generated method stub } /* (non-Javadoc) * @see org.apache.directory.server.core.schema.SchemaChangeHandler#move( * org.apache.directory.shared.ldap.name.LdapDN, org.apache.directory.shared.ldap.name.LdapDN, * Rdn, boolean, javax.naming.directory.Attributes) */ public void move( LdapDN oriChildName, LdapDN newParentName, Rdn newRn, boolean deleteOldRn, ServerEntry entry, boolean cascade ) throws NamingException { // TODO Auto-generated method stub } /* (non-Javadoc) * @see org.apache.directory.server.core.schema.SchemaChangeHandler#move( * org.apache.directory.shared.ldap.name.LdapDN, * org.apache.directory.shared.ldap.name.LdapDN, javax.naming.directory.Attributes) */ public void replace( LdapDN oriChildName, LdapDN newParentName, ServerEntry entry, boolean cascade ) throws NamingException { // TODO Auto-generated method stub } /* (non-Javadoc) * @see org.apache.directory.server.core.schema.SchemaChangeHandler#rename( * org.apache.directory.shared.ldap.name.LdapDN, javax.naming.directory.Attributes, Rdn, boolean) */ public void rename( LdapDN name, ServerEntry entry, Rdn newRdn, boolean cascade ) throws NamingException { // TODO Auto-generated method stub } public void add( NameForm nf ) |
File | Project | Line |
---|---|---|
org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java | ApacheDS Generalized (X) DBM Search Engine | 138 |
org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java | ApacheDS Generalized (X) DBM Search Engine | 154 |
} // get the attribute ServerAttribute attr = ( ServerAttribute ) entry.get( type ); // if the attribute does not exist just return false //noinspection unchecked if ( attr != null && evaluate( ( IndexEntry<Object,ServerEntry> ) indexEntry, attr ) ) { return true; } // If we do not have the attribute, loop through the sub classes of // the attributeType. Perhaps the entry has an attribute value of a // subtype (descendant) that will produce a match if ( registries.getAttributeTypeRegistry().hasDescendants( node.getAttribute() ) ) { // TODO check to see if descendant handling is necessary for the // index so we can match properly even when for example a name // attribute is used instead of more specific commonName Iterator<AttributeType> descendants = registries.getAttributeTypeRegistry().descendants( node.getAttribute() ); while ( descendants.hasNext() ) { AttributeType descendant = descendants.next(); attr = ( ServerAttribute ) entry.get( descendant ); //noinspection unchecked if ( attr != null && evaluate( ( IndexEntry<Object,ServerEntry> ) indexEntry, attr ) ) { return true; } } } // we fell through so a match was not found - assertion was false. return false; } public boolean evaluate( ServerEntry entry ) throws Exception |
File | Project | Line |
---|---|---|
org/apache/directory/server/schema/DnComparator.java | ApacheDS Schema Registries | 79 |
org/apache/directory/server/schema/NameAndOptionalUIDComparator.java | ApacheDS Schema Registries | 168 |
} public LdapDN getDn( Object obj ) throws NamingException { LdapDN dn = null; if ( obj instanceof LdapDN ) { dn = (LdapDN)obj; dn = ( dn.isNormalized() ? dn : LdapDN.normalize( dn, attrRegistry.getNormalizerMapping() ) ); } else if ( obj instanceof Name ) { dn = new LdapDN( ( Name ) obj ); dn.normalize( attrRegistry.getNormalizerMapping() ); } else if ( obj instanceof String ) { dn = new LdapDN( ( String ) obj ); dn.normalize( attrRegistry.getNormalizerMapping() ); } else { throw new IllegalStateException( "I do not know how to handle dn comparisons with objects of class: " + (obj == null ? null : obj.getClass() ) ); } return dn; } } |
File | Project | Line |
---|---|---|
org/apache/directory/server/ldap/handlers/BindHandler.java | ApacheDS Protocol Ldap | 202 |
org/apache/directory/server/ldap/handlers/bind/SimpleMechanismHandler.java | ApacheDS Protocol Ldap | 105 |
String msg = "Bind failed: " + e.getMessage(); if ( LOG.isDebugEnabled() ) { msg += ":\n" + ExceptionUtils.getStackTrace( e ); msg += "\n\nBindRequest = \n" + bindRequest.toString(); } Name name = null; if ( e instanceof LdapAuthenticationException ) { name = ((LdapAuthenticationException)e).getResolvedName(); } if ( ( name != null ) && ( ( code == ResultCodeEnum.NO_SUCH_OBJECT ) || ( code == ResultCodeEnum.ALIAS_PROBLEM ) || ( code == ResultCodeEnum.INVALID_DN_SYNTAX ) || ( code == ResultCodeEnum.ALIAS_DEREFERENCING_PROBLEM ) ) ) { result.setMatchedDn( new LdapDN( name ) ); } result.setErrorMessage( msg ); ldapSession.getIoSession().write( bindRequest.getResultResponse() ); } |
File | Project | Line |
---|---|---|
org/apache/directory/server/kerberos/shared/crypto/encryption/AesCtsSha1Encryption.java | ApacheDS Protocol Kerberos Shared | 124 |
org/apache/directory/server/kerberos/shared/crypto/encryption/Des3CbcSha1KdEncryption.java | ApacheDS Protocol Kerberos Shared | 132 |
byte[] dataBytes = concatenateBytes( conFounder, paddedPlainText ); byte[] checksumBytes = calculateIntegrity( dataBytes, key.getKeyValue(), usage ); //byte[] encryptedData = encrypt( paddedDataBytes, key.getKeyValue() ); byte[] encryptedData = encrypt( dataBytes, Ke ); byte[] cipherText = concatenateBytes( encryptedData, checksumBytes ); return new EncryptedData( getEncryptionType(), key.getKeyVersion(), cipherText ); } public byte[] encrypt( byte[] plainText, byte[] keyBytes ) { return processCipher( true, plainText, keyBytes ); } public byte[] decrypt( byte[] cipherText, byte[] keyBytes ) { return processCipher( false, cipherText, keyBytes ); } /** * Derived Key = DK(Base Key, Well-Known Constant) * DK(Key, Constant) = random-to-key(DR(Key, Constant)) * DR(Key, Constant) = k-truncate(E(Key, Constant, initial-cipher-state)) */ protected byte[] deriveKey( byte[] baseKey, byte[] usage, int n, int k ) { |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/schema/SchemaPartitionDao.java | ApacheDS Core | 224 |
org/apache/directory/server/core/schema/SchemaPartitionDao.java | ApacheDS Core | 362 |
new ClientStringValue( MetaSchemaConstants.META_SYNTAX_CHECKER_OC ) ) ); if ( NUMERIC_OID_CHECKER.isValidSyntax( oid ) ) { filter.addNode( new EqualityNode<String>( M_OID_OID, new ClientStringValue( oid ) ) ); } else { filter.addNode( new EqualityNode<String>( M_NAME_OID, new ClientStringValue( oid.toLowerCase() ) ) ); } SearchControls searchControls = new SearchControls(); searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE ); EntryFilteringCursor cursor = null; try { cursor = partition.search( new SearchOperationContext( null, partition.getSuffixDn(), AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) ); if ( !cursor.next() ) { return false; } if ( cursor.next() ) { throw new NamingException( "Got more than one syntaxChecker for oid of " + oid ); |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/schema/SchemaPartitionDao.java | ApacheDS Core | 800 |
org/apache/directory/server/core/schema/SchemaPartitionDao.java | ApacheDS Core | 849 |
public Set<ServerEntry> listEnabledSchemaDependents( String schemaName ) throws Exception { Set<ServerEntry> set = new HashSet<ServerEntry>(); BranchNode filter = new AndNode(); filter.addNode( new EqualityNode<String>( OBJECTCLASS_OID, new ClientStringValue( MetaSchemaConstants.META_SCHEMA_OC.toLowerCase() ) ) ); filter.addNode( new EqualityNode<String>( M_DEPENDENCIES_OID, new ClientStringValue( schemaName.toLowerCase() ) ) ); SearchControls searchControls = new SearchControls(); searchControls.setSearchScope( SearchControls.ONELEVEL_SCOPE ); EntryFilteringCursor cursor = null; try { cursor = partition.search( new SearchOperationContext( null, partition.getSuffixDn(), AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) ); while ( cursor.next() ) { |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/subtree/SubentryInterceptor.java | ApacheDS Core | 775 |
org/apache/directory/server/core/subtree/SubentryInterceptor.java | ApacheDS Core | 926 |
ExprNode filter = new PresenceNode( SchemaConstants.OBJECT_CLASS_AT ); SearchControls controls = new SearchControls(); controls.setSearchScope( SearchControls.SUBTREE_SCOPE ); controls.setReturningAttributes( new String[] { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES } ); EntryFilteringCursor subentries = nexus.search( new SearchOperationContext( opContext.getSession(), baseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) ); while ( subentries.next() ) { ServerEntry candidate = subentries.get(); LdapDN dn = candidate.getDn(); dn.normalize( atRegistry.getNormalizerMapping() ); if ( evaluator.evaluate( ss, apName, dn, candidate ) ) { nexus.modify( new ModifyOperationContext( opContext.getSession(), dn, getOperationalModsForReplace( oriChildName, newName, subentry, candidate ) ) ); |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursor.java | ApacheDS JDBM Store | 110 |
org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursor.java | ApacheDS JDBM Store | 185 |
if ( containerCursor.next() ) { containerTuple.setBoth( containerCursor.get() ); DupsContainer<V> values = containerTuple.getValue(); if ( values.isAvlTree() ) { AvlTree<V> set = values.getAvlTree(); dupsCursor = new AvlTreeCursor<V>( set ); } else { BTree tree = table.getBTree( values.getBTreeRedirect() ); dupsCursor = new KeyBTreeCursor<V>( tree, table.getValueComparator() ); } if ( value == null ) { return; } // only advance the dupsCursor if we're on same key if ( table.getKeyComparator().compare( containerTuple.getKey(), key ) == 0 ) { dupsCursor.after( value ); |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/schema/SchemaEntityFactory.java | ApacheDS Core | 454 |
org/apache/directory/server/schema/bootstrap/SystemNormalizerProducer.java | ApacheDS Bootstrap Schemas | 110 |
Object[] args = new Object[] { registries }; method.invoke( obj, args ); } catch ( SecurityException e ) { NamingException ne = new NamingException( "SyntaxChecker class "+ className + " could not have the Registries dependency injected." ); ne.setRootCause( e ); throw ne; } catch ( NoSuchMethodException e ) { // this is ok since not every object may have setRegistries() } catch ( IllegalArgumentException e ) { NamingException ne = new NamingException( "SyntaxChecker class "+ className + " could not have the Registries dependency injected." ); ne.setRootCause( e ); throw ne; } catch ( IllegalAccessException e ) { NamingException ne = new NamingException( "SyntaxChecker class "+ className + " could not have the Registries dependency injected." ); ne.setRootCause( e ); throw ne; } catch ( InvocationTargetException e ) { NamingException ne = new NamingException( "SyntaxChecker class "+ className + " could not have the Registries dependency injected." ); ne.setRootCause( e ); throw ne; } } |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/entry/ServerEntryPropertyEditor.java | ApacheDS Core Entry | 73 |
org/apache/directory/server/core/configuration/AttributesPropertyEditor.java | ApacheDS Core | 77 |
public String getAsText() { LdifComposer composer = new LdifComposerImpl(); Map<String, Object> map = new MultiValueMap(); Attributes attrs = (Attributes) getValue(); try { NamingEnumeration<? extends Attribute> e = attrs.getAll(); while ( e.hasMore() ) { Attribute attr = e.next(); NamingEnumeration<? extends Object> e2 = attr.getAll(); while ( e2.hasMoreElements() ) { Object value = e2.next(); map.put( attr.getID(), value ); } } return composer.compose( map ); } catch ( Exception e ) { |
File | Project | Line |
---|---|---|
org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java | ApacheDS Generalized (X) DBM Search Engine | 58 |
org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java | ApacheDS Generalized (X) DBM Search Engine | 58 |
public LessEqEvaluator( LessEqNode node, Store<ServerEntry> db, Registries registries ) throws Exception { this.db = db; this.node = node; this.registries = registries; this.type = registries.getAttributeTypeRegistry().lookup( node.getAttribute() ); if ( db.hasUserIndexOn( node.getAttribute() ) ) { //noinspection unchecked idx = ( Index<Object,ServerEntry> ) db.getUserIndex( node.getAttribute() ); } else { idx = null; } /* * We prefer matching using the Normalizer and Comparator pair from * the ordering matchingRule if one is available. It may very well * not be. If so then we resort to using the Normalizer and * Comparator from the equality matchingRule as a last resort. */ MatchingRule mr = type.getOrdering(); if ( mr == null ) { mr = type.getEquality(); } if ( mr == null ) { throw new IllegalStateException( |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/partition/impl/btree/gui/AnnotatedFilterTreeDialog.java | ApacheDS Core | 89 |
org/apache/directory/server/core/partition/impl/btree/gui/SearchResultDialog.java | ApacheDS Core | 104 |
new java.awt.Color( 153, 153, 153 ), 1 ), "Specifications", javax.swing.border.TitledBorder.LEADING, javax.swing.border.TitledBorder.TOP, new java.awt.Font( "SansSerif", 0, 14 ), new java.awt.Color( 60, 60, 60 ) ) ); jPanel1.add( jTextArea1, java.awt.BorderLayout.CENTER ); jScrollPane1.getViewport().add( jTree1 ); jTree1.setBounds( new java.awt.Rectangle( 238, 142, 82, 80 ) ); jTextArea1.setText( "" ); jTextArea1.setEditable( false ); setBounds( new java.awt.Rectangle( 0, 0, 485, 434 ) ); |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/jndi/EventListenerAdapter.java | ApacheDS Core JNDI | 189 |
org/apache/directory/server/core/jndi/EventListenerAdapter.java | ApacheDS Core JNDI | 214 |
public void entryMovedAndRenamed( MoveAndRenameOperationContext opContext ) { try { if ( listener instanceof NamespaceChangeListener ) { Binding newBinding = new Binding( opContext.getDn().getUpName(), ServerEntryUtils.toBasicAttributes( opContext.getEntry() ), false ); Binding oldBinding = new Binding( opContext.getDn().getUpName(), ServerEntryUtils.toBasicAttributes( opContext.getEntry().getOriginalEntry() ), false ); NamingEvent evt = new NamingEvent( source, NamingEvent.OBJECT_RENAMED, newBinding, oldBinding, opContext ); ( ( NamespaceChangeListener ) listener ).objectRenamed( evt ); } } catch ( Exception e ) { deliverNamingExceptionEvent( e, opContext ); } } /* (non-Javadoc) * @see org.apache.directory.server.core.event.DirectoryListener#entryRenamed(org.apache.directory.server.core.interceptor.context.RenameOperationContext) */ public void entryRenamed( RenameOperationContext opContext ) |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/integ/InheritableSettings.java | ApacheDS Core Integration | 104 |
org/apache/directory/server/integ/InheritableServerSettings.java | ApacheDS Server Integration | 104 |
public InheritableServerSettings getParent() { return parent; } /** * @return <code>true</code> if we are at the suite level */ public boolean isSuiteLevel() { return parent == null; } /** * @return <code>true</code> if we are at the class level */ public boolean isClassLevel() { return ( parent != null ) && ( parent.getParent() == null ); } /** * @return <code>true</code> if we are at the method level */ public boolean isMethodLevel() { return ( parent != null ) && ( parent.getParent() != null ); } /** * @return the test mode. Default to ROLLBACK */ public SetupMode getMode() { SetupMode parentMode = DEFAULT_MODE; if ( parent != null ) { parentMode = parent.getMode(); } // Get the @Mode annotation Mode annotation = description.getAnnotation( Mode.class ); if ( annotation == null ) { return parentMode; } else { return annotation.value(); } } /** * @return the DirectoryService factory * @throws IllegalAccessException if we can't access the factory * @throws InstantiationException if the DirectoryService can't be instanciated */ public LdapServerFactory getFactory() throws IllegalAccessException, InstantiationException |
File | Project | Line |
---|---|---|
org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java | ApacheDS Generalized (X) DBM Search Engine | 269 |
org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java | ApacheDS Generalized (X) DBM Search Engine | 364 |
return true; } } // Fall through as we didn't find any matching value for this attribute. // We will have to check in the potential descendant, if any. } // If we do not have the attribute, loop through the descendant // May be the node Attribute has descendant ? if ( registries.getAttributeTypeRegistry().hasDescendants( node.getAttribute() ) ) { // TODO check to see if descendant handling is necessary for the // index so we can match properly even when for example a name // attribute is used instead of more specific commonName Iterator<AttributeType> descendants = registries.getAttributeTypeRegistry().descendants( node.getAttribute() ); while ( descendants.hasNext() ) { AttributeType descendant = descendants.next(); attr = ( ServerAttribute ) entry.get( descendant ); if ( null != attr ) { /* * Cycle through the attribute values testing normalized version * obtained from using the substring matching rule's normalizer. * The test uses the comparator obtained from the appropriate * substring matching rule. */ for ( Value value : attr ) { value.normalize( normalizer ); String strValue = ( String ) value.getNormalizedValue(); // Once match is found cleanup and return true if ( regex.matcher( strValue ).matches() ) { |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/authn/SimpleAuthenticator.java | ApacheDS Core | 116 |
org/apache/directory/server/core/partition/ByPassConstants.java | ApacheDS Core | 150 |
c.add( ChangeLogInterceptor.class.getName() ); c.add( AciAuthorizationInterceptor.class.getName() ); c.add( DefaultAuthorizationInterceptor.class.getName() ); c.add( ExceptionInterceptor.class.getName() ); c.add( OperationalAttributeInterceptor.class.getName() ); c.add( SchemaInterceptor.class.getName() ); c.add( SubentryInterceptor.class.getName() ); c.add( CollectiveAttributeInterceptor.class.getName() ); c.add( EventInterceptor.class.getName() ); c.add( TriggerInterceptor.class.getName() ); |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/authz/support/ACDFEngine.java | ApacheDS Core | 152 |
org/apache/directory/server/core/authz/support/MaxImmSubFilter.java | ApacheDS Core | 142 |
static { Collection<String> c = new HashSet<String>(); c.add( NormalizationInterceptor.class.getName() ); c.add( AuthenticationInterceptor.class.getName() ); c.add( AciAuthorizationInterceptor.class.getName() ); c.add( DefaultAuthorizationInterceptor.class.getName() ); c.add( OperationalAttributeInterceptor.class.getName() ); c.add( SchemaInterceptor.class.getName() ); c.add( SubentryInterceptor.class.getName() ); c.add( EventInterceptor.class.getName() ); |
File | Project | Line |
---|---|---|
org/apache/directory/server/schema/registries/DefaultComparatorRegistry.java | ApacheDS Schema Registries | 145 |
org/apache/directory/server/schema/registries/DefaultNormalizerRegistry.java | ApacheDS Schema Registries | 146 |
return desc.getExtensions().get( "X-SCHEMA" ).get( 0 ); } public Iterator<String> oidIterator() { return byOid.keySet().iterator(); } public void unregister( String oid ) throws NamingException { if ( ! Character.isDigit( oid.charAt( 0 ) ) ) { throw new NamingException( "OID " + oid + " is not a numeric OID" ); } this.byOid.remove( oid ); this.oidToDescription.remove( oid ); } public void unregisterSchemaElements( String schemaName ) { List<String> oids = new ArrayList<String>( byOid.keySet() ); for ( String oid : oids ) { |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/authn/SimpleAuthenticator.java | ApacheDS Core | 114 |
org/apache/directory/server/core/partition/ByPassConstants.java | ApacheDS Core | 103 |
c = new HashSet<String>(); c.add( NormalizationInterceptor.class.getName() ); c.add( AuthenticationInterceptor.class.getName() ); c.add( AciAuthorizationInterceptor.class.getName() ); c.add( DefaultAuthorizationInterceptor.class.getName() ); c.add( ExceptionInterceptor.class.getName() ); c.add( OperationalAttributeInterceptor.class.getName() ); c.add( SchemaInterceptor.class.getName() ); c.add( SubentryInterceptor.class.getName() ); c.add( EventInterceptor.class.getName() ); |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/integ/CiSuite.java | ApacheDS Core Integration | 83 |
org/apache/directory/server/integ/SiSuite.java | ApacheDS Server Integration | 85 |
SiRunner cir = ( SiRunner) runner; cir.setSuite( this ); super.add( runner ); } else if ( runner instanceof IgnoredClassRunner ) { // allow this one } else { throw new IllegalArgumentException( String.format( "Unexpected runner type \"%s\". " + "Test classes within CiSuites must use CiRunners.", runner ) ); } } @Override public void run( final RunNotifier notifier ) { super.run( notifier ); /* * For any service scope other than test system scope, we must have to * shutdown the sevice and cleanup the working directory. Failures to * do this without exception shows that something is wrong with the * server and so the entire test should be marked as failed. So we * presume that tests have failed in the suite if the fixture is in an * inconsistent state. Who knows if this inconsistent state of the * service could have made it so false results were acquired while * running tests. */ if ( settings.getCleanupLevel() != Level.SYSTEM ) { try { shutdown(); cleanup(); destroy(); } catch ( Exception e ) { notifier.fireTestFailure( new Failure( getDescription(), e ) ); } } } public InheritableServerSettings getSettings() |
File | Project | Line |
---|---|---|
org/apache/directory/server/xdbm/search/impl/AndEvaluator.java | ApacheDS Generalized (X) DBM Search Engine | 48 |
org/apache/directory/server/xdbm/search/impl/OrEvaluator.java | ApacheDS Generalized (X) DBM Search Engine | 48 |
public OrEvaluator( OrNode node, List<Evaluator<? extends ExprNode, ServerEntry>> evaluators ) { this.node = node; this.evaluators = optimize( evaluators ); } /** * Takes a set of Evaluators and copies then sorts them in a new list with * decreasing scan counts on their expression nodes. This is done to have * the Evaluators with the greatest scan counts which have the highest * probability of accepting a candidate first. That will increase the * chance of shorting the checks on evaluators early so extra lookups and * comparisons are avoided. * * @param unoptimized the unoptimized list of Evaluators * @return optimized Evaluator list with decreasing scan count ordering */ private List<Evaluator<? extends ExprNode,ServerEntry>> optimize( List<Evaluator<? extends ExprNode, ServerEntry>> unoptimized ) { List<Evaluator<? extends ExprNode, ServerEntry>> optimized = new ArrayList<Evaluator<? extends ExprNode, ServerEntry>>( unoptimized.size() ); optimized.addAll( unoptimized ); Collections.sort( optimized, new Comparator<Evaluator<? extends ExprNode,ServerEntry>>() |
File | Project | Line |
---|---|---|
org/apache/directory/server/dhcp/service/StoreBasedDhcpService.java | ApacheDS Protocol Dhcp | 178 |
org/apache/directory/server/dhcp/service/StoreBasedDhcpService.java | ApacheDS Protocol Dhcp | 269 |
reply.getOptions().merge( lease.getOptions() ); reply.setAssignedClientAddress( lease.getClientAddress() ); reply.setNextServerAddress( lease.getNextServerAddress() ); // fix options OptionsField options = reply.getOptions(); // these options must not be present options.remove( RequestedIpAddress.class ); options.remove( ParameterRequestList.class ); options.remove( ClientIdentifier.class ); options.remove( MaximumDhcpMessageSize.class ); // these options must be present options.add( new IpAddressLeaseTime( ( lease.getExpires() - System.currentTimeMillis() ) / 1000L ) ); stripUnwantedOptions( request, options ); } return reply; } |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleAvlCursor.java | ApacheDS JDBM Store | 55 |
org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java | ApacheDS JDBM Store | 65 |
this.browser = btree.browse(); } private void clearValue() { returnedTuple.setKey( key ); returnedTuple.setValue( null ); valueAvailable = false; } public boolean available() { return valueAvailable; } public void beforeKey( K key ) throws Exception { throw new UnsupportedOperationException( "This cursor locks down the key so keywise advances are not allowed." ); } public void afterKey( K key ) throws Exception { throw new UnsupportedOperationException( "This cursor locks down the key so keywise advances are not allowed." ); } public void beforeValue( K key, V value ) throws Exception { checkNotClosed( "beforeValue()" ); if ( key != null && ! key.equals( this.key ) ) { throw new UnsupportedOperationException( "This cursor locks down the key so keywise advances are not allowed." ); } |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java | ApacheDS Core | 520 |
org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java | ApacheDS Core | 590 |
if ( filters.isEmpty() ) { prefetched = tempResult; filterContents( prefetched ); return true; } if ( filters.size() == 1 ) { if ( filters.get( 0 ).accept( getOperationContext(), tempResult ) ) { prefetched = tempResult; filterContents( prefetched ); return true; } } /* E N D O P T I M I Z A T I O N */ for ( EntryFilter filter : filters ) { // if a filter rejects then short and continue with outer loop if ( ! ( accepted &= filter.accept( getOperationContext(), tempResult ) ) ) { continue outer; } } /* * Here the entry has been accepted by all filters. */ prefetched = tempResult; filterContents( prefetched ); return true; } prefetched = null; return false; } /* * @see Iterable#iterator() */ /* (non-Javadoc) * @see org.apache.directory.server.core.filtering.EntryFilteringCursor#iterator() */ public Iterator<ClonedServerEntry> iterator() |
File | Project | Line |
---|---|---|
org/apache/directory/server/schema/bootstrap/ApachemetaSyntaxProducer.java | ApacheDS Bootstrap Schemas | 141 |
org/apache/directory/server/schema/bootstrap/ApachemetaSyntaxProducer.java | ApacheDS Bootstrap Schemas | 195 |
private final static String[] NAMES = new String[] { "objectClassType" }; public final SyntaxChecker getSyntaxChecker() throws NamingException { return CHECKER; } public final boolean isHumanReadable() { return true; } public final String getDescription() { return "The syntax for either numeric ids or names."; } public final String getName() { return NAMES[0]; } public final String[] getNamesRef() { return NAMES; } public final String getOid() { return OID; } public final boolean isObsolete() { return false; } public String getSchema() { return MetaSchemaConstants.SCHEMA_NAME; } public void setSchema( String schemaName ) { throw new NotImplementedException(); } } public static class NumberSyntax implements Syntax |
File | Project | Line |
---|---|---|
org/apache/directory/server/kerberos/shared/crypto/checksum/Crc32Checksum.java | ApacheDS Protocol Kerberos Shared | 41 |
org/apache/directory/server/kerberos/shared/crypto/encryption/DesCbcCrcEncryption.java | ApacheDS Protocol Kerberos Shared | 69 |
public byte[] calculateIntegrity( byte[] data, byte[] key, KeyUsage usage ) { CRC32 crc32 = new CRC32(); crc32.update( data ); return int2octet( ( int ) crc32.getValue() ); } private byte[] int2octet( int value ) { byte[] bytes = new byte[4]; int i, shift; for ( i = 0, shift = 24; i < 4; i++, shift -= 8 ) { bytes[i] = ( byte ) ( 0xFF & ( value >> shift ) ); } return bytes; } |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/authz/support/MicroOperationFilter.java | ApacheDS Core | 48 |
org/apache/directory/server/core/authz/support/RelatedProtectedItemFilter.java | ApacheDS Core | 75 |
public Collection<ACITuple> filter( Registries registries, Collection<ACITuple> tuples, OperationScope scope, OperationContext opContext, Collection<LdapDN> userGroupNames, LdapDN userName, ServerEntry userEntry, AuthenticationLevel authenticationLevel, LdapDN entryName, String attrId, Value<?> attrValue, ServerEntry entry, Collection<MicroOperation> microOperations, ServerEntry entryView ) throws NamingException { if ( tuples.size() == 0 ) { return tuples; } for ( Iterator<ACITuple> i = tuples.iterator(); i.hasNext(); ) { ACITuple tuple = i.next(); |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/entry/DefaultServerEntry.java | ApacheDS Core Entry | 1715 |
org/apache/directory/server/core/entry/DefaultServerEntry.java | ApacheDS Core Entry | 1780 |
public boolean remove( AttributeType attributeType, String... values ) throws NamingException { try { EntryAttribute attribute = attributes.get( attributeType ); if ( attribute == null ) { // Can't remove values from a not existing attribute ! return false; } int nbOldValues = attribute.size(); // Remove the values attribute.remove( values ); if ( attribute.size() == 0 ) { // No mare values, remove the attribute attributes.remove( attributeType ); return true; } if ( nbOldValues != attribute.size() ) { // At least one value have been removed, return true. return true; } else { // No values have been removed, return false. return false; } } catch ( IllegalArgumentException iae ) { LOG.error( "The removal of values for the missing '{}' attribute is not possible", attributeType ); return false; } } /** * <p> * Removes the specified values from an attribute. * </p> * <p> * If at least one value is removed, this method returns <code>true</code>. * </p> * <p> * If there is no more value after having removed the values, the attribute * will be removed too. * </p> * <p> * If the attribute does not exist, nothing is done and the method returns * <code>false</code> * </p> * * @param attributeType The attribute type * @param values the values to be removed * @return <code>true</code> if at least a value is removed, <code>false</code> * if not all the values have been removed or if the attribute does not exist. */ public boolean remove( AttributeType attributeType, Value<?>... values ) throws NamingException |
File | Project | Line |
---|---|---|
org/apache/directory/server/kerberos/shared/store/KerberosCatalog.java | ApacheDS Protocol Kerberos Shared | 55 |
org/apache/directory/server/dns/store/jndi/DnsCatalog.java | ApacheDS Protocol Dns | 53 |
if ( name.endsWith( "." ) ) { int last = name.lastIndexOf( "." ); name = name.substring( 0, last ); } while ( !name.equals( "" ) && name != null ) { String candidate = ( String ) map.get( name ); if ( candidate != null ) { return candidate; } int period = name.indexOf( "." ); if ( period > -1 ) { name = name.substring( period + 1 ); } else { return ""; } } return ""; } } |
File | Project | Line |
---|---|---|
org/apache/directory/server/xdbm/AbstractIndexCursor.java | ApacheDS XDBM Base | 36 |
org/apache/directory/server/xdbm/AbstractTupleCursor.java | ApacheDS XDBM Base | 36 |
public abstract class AbstractTupleCursor<K,V> implements TupleCursor<K,V> { private ClosureMonitor monitor = new DefaultClosureMonitor(); public final void setClosureMonitor( ClosureMonitor monitor ) { if ( monitor == null ) { throw new NullPointerException( "monitor" ); } this.monitor = monitor; } protected final void checkNotClosed( String operation ) throws Exception { monitor.checkNotClosed(); } public final boolean isClosed() { return monitor.isClosed(); } public void close() throws Exception { monitor.close(); } public void close( Exception cause ) throws Exception { monitor.close( cause ); } public Iterator<Tuple<K,V>> iterator() |
File | Project | Line |
---|---|---|
org/apache/directory/server/changepw/protocol/ChangePasswordTcpDecoder.java | ApacheDS Protocol Change Password | 38 |
org/apache/directory/server/kerberos/protocol/KerberosTcpDecoder.java | ApacheDS Protocol Kerberos | 40 |
private KdcRequestDecoder decoder = new KdcRequestDecoder(); private int maxObjectSize = 16384; // 16KB /** * Returns the allowed maximum size of the object to be decoded. * If the size of the object to be decoded exceeds this value, this * decoder will throw a {@link BufferDataException}. The default * value is <tt>16384</tt> (16KB). * * @return The max object size. */ public int getMaxObjectSize() { return maxObjectSize; } /** * Sets the allowed maximum size of the object to be decoded. * If the size of the object to be decoded exceeds this value, this * decoder will throw a {@link BufferDataException}. The default * value is <tt>16384</tt> (16KB). * * @param maxObjectSize */ public void setMaxObjectSize( int maxObjectSize ) { if ( maxObjectSize <= 0 ) { throw new IllegalArgumentException( "maxObjectSize: " + maxObjectSize ); } this.maxObjectSize = maxObjectSize; } @Override protected boolean doDecode( IoSession session, ByteBuffer in, ProtocolDecoderOutput out ) throws Exception { if ( !in.prefixedDataAvailable( 4, maxObjectSize ) ) { return false; } in.getInt(); out.write( decoder.decode( in.buf() ) ); return true; } } |
File | Project | Line |
---|---|---|
org/apache/directory/server/kerberos/shared/io/encoder/KdcReplyEncoder.java | ApacheDS Protocol Kerberos Shared | 95 |
org/apache/directory/server/kerberos/shared/io/encoder/KdcRequestEncoder.java | ApacheDS Protocol Kerberos Shared | 191 |
return sequence; } /* PA-DATA ::= SEQUENCE { padata-type[1] INTEGER, padata-value[2] OCTET STRING, -- might be encoded AP-REQ }*/ private DERSequence encodePreAuthData( PaData[] preAuthData ) { DERSequence preAuth = new DERSequence(); for ( int ii = 0; ii < preAuthData.length; ii++ ) { DERSequence sequence = new DERSequence(); sequence.add( new DERTaggedObject( 1, DERInteger.valueOf( preAuthData[ii].getPaDataType().getOrdinal() ) ) ); sequence.add( new DERTaggedObject( 2, new DEROctetString( preAuthData[ii].getPaDataValue() ) ) ); preAuth.add( sequence ); } return preAuth; } } |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilter.java | ApacheDS Core | 54 |
org/apache/directory/server/core/authz/support/MostSpecificUserClassFilter.java | ApacheDS Core | 52 |
public class MostSpecificUserClassFilter implements ACITupleFilter { public Collection<ACITuple> filter( Registries registries, Collection<ACITuple> tuples, OperationScope scope, OperationContext opContext, Collection<LdapDN> userGroupNames, LdapDN userName, ServerEntry userEntry, AuthenticationLevel authenticationLevel, LdapDN entryName, String attrId, Value<?> attrValue, ServerEntry entry, Collection<MicroOperation> microOperations, ServerEntry entryView ) throws NamingException { if ( tuples.size() <= 1 ) { return tuples; } Collection<ACITuple> filteredTuples = new ArrayList<ACITuple>(); // If there are any tuples matching the requestor with UserClasses // element name or thisEntry, discard all other tuples. for ( ACITuple tuple:tuples ) { for ( UserClass userClass:tuple.getUserClasses() ) |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/integ/state/TestServiceContext.java | ApacheDS Core Integration | 121 |
org/apache/directory/server/integ/state/TestServerContext.java | ApacheDS Server Integration | 122 |
public static void create( InheritableServerSettings settings ) throws NamingException { get().state.create( settings ); } /** * Action where an attempt is made to destroy the service. This * entails nulling out reference to it and triggering garbage * collection. */ public static void destroy() { get().state.destroy(); } /** * Action where an attempt is made to erase the contents of the * working directory used by the service for various files including * partition database files. * * @throws IOException on errors while deleting the working directory */ public static void cleanup() throws IOException { get().state.cleanup(); } /** * Action where an attempt is made to start up the service. * * @throws Exception on failures to start the core directory service */ public static void startup() throws Exception { get().state.startup(); } /** * Action where an attempt is made to shutdown the service. * * @throws Exception on failures to stop the core directory service */ public static void shutdown() throws Exception { get().state.shutdown(); } /** * Action where an attempt is made to run a test against the service. * * @param testClass the class whose test method is to be run * @param testMethod the test method which is to be run * @param notifier a notifier to report failures to * @param settings the inherited settings and annotations associated with * the test method */ public static void test( TestClass testClass, TestMethod testMethod, RunNotifier notifier, |
File | Project | Line |
---|---|---|
org/apache/directory/server/dhcp/service/StoreBasedDhcpService.java | ApacheDS Protocol Dhcp | 151 |
org/apache/directory/server/dhcp/service/StoreBasedDhcpService.java | ApacheDS Protocol Dhcp | 246 |
protected DhcpMessage handleREQUEST( InetSocketAddress localAddress, InetSocketAddress clientAddress, DhcpMessage request ) throws DhcpException { // check server ident AddressOption serverIdentOption = ( AddressOption ) request.getOptions().get( ServerIdentifier.class ); if ( null != serverIdentOption && serverIdentOption.getAddress().isAnyLocalAddress() ) return null; // not me?! FIXME: handle authoritative server case Lease lease = getExistingLease( clientAddress, request ); DhcpMessage reply = initGeneralReply( localAddress, request ); if ( null == lease ) { // null lease? send NAK reply.setMessageType( MessageType.DHCPNAK ); reply.setCurrentClientAddress( null ); reply.setAssignedClientAddress( null ); reply.setNextServerAddress( null ); } else { |
File | Project | Line |
---|---|---|
org/apache/directory/server/integ/ServerIntegrationUtils.java | ApacheDS Server Integration | 120 |
org/apache/directory/server/integ/ServerIntegrationUtils.java | ApacheDS Server Integration | 143 |
public static LdapContext getWiredContextFollowOnRefferal( LdapService ldapService ) throws Exception { LOG.debug( "Creating a wired context to local LDAP server on port {}", ldapService.getIpPort() ); Hashtable<String, String> env = new Hashtable<String, String>(); env.put( Context.INITIAL_CONTEXT_FACTORY, CTX_FACTORY ); env.put( Context.PROVIDER_URL, "ldap://localhost:" + ldapService.getIpPort() ); env.put( Context.SECURITY_PRINCIPAL, ServerDNConstants.ADMIN_SYSTEM_DN ); env.put( Context.SECURITY_CREDENTIALS, "secret" ); env.put( Context.SECURITY_AUTHENTICATION, "simple" ); env.put( Context.REFERRAL, "follow" ); |
File | Project | Line |
---|---|---|
org/apache/directory/server/dns/io/encoder/QuestionRecordEncoder.java | ApacheDS Protocol Dns | 50 |
org/apache/directory/server/dns/io/encoder/ResourceRecordEncoder.java | ApacheDS Protocol Dns | 82 |
protected void putDomainName( ByteBuffer byteBuffer, String domainName ) { String[] labels = domainName.split( "\\." ); for ( int ii = 0; ii < labels.length; ii++ ) { byteBuffer.put( ( byte ) labels[ii].length() ); char[] characters = labels[ii].toCharArray(); for ( int jj = 0; jj < characters.length; jj++ ) { byteBuffer.put( ( byte ) characters[jj] ); } } byteBuffer.put( ( byte ) 0x00 ); } |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/kerberos/PasswordPolicyInterceptor.java | ApacheDS Interceptors for Kerberos | 205 |
org/apache/directory/server/changepw/service/CheckPasswordPolicy.java | ApacheDS Protocol Change Password | 78 |
} /** * Tests that: * The password is at least six characters long. * The password contains a mix of characters. * The password does not contain three letter (or more) tokens from the user's account name. */ boolean isValid( String username, String password, int passwordLength, int categoryCount, int tokenSize ) { return isValidPasswordLength( password, passwordLength ) && isValidCategoryCount( password, categoryCount ) && isValidUsernameSubstring( username, password, tokenSize ); } /** * The password is at least six characters long. */ boolean isValidPasswordLength( String password, int passwordLength ) { return password.length() >= passwordLength; } /** * The password contains characters from at least three of the following four categories: * English uppercase characters (A - Z) * English lowercase characters (a - z) * Base 10 digits (0 - 9) * Any non-alphanumeric character (for example: !, $, #, or %) */ boolean isValidCategoryCount( String password, int categoryCount ) { int uppercase = 0; int lowercase = 0; int digit = 0; int nonAlphaNumeric = 0; char[] characters = password.toCharArray(); for ( int ii = 0; ii < characters.length; ii++ ) |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/OperationManager.java | ApacheDS Core | 83 |
org/apache/directory/server/core/interceptor/NextInterceptor.java | ApacheDS Core | 99 |
void removeContextPartition( RemoveContextPartitionOperationContext opContext ) throws Exception; /** * Calls the next interceptor's {@link Interceptor#delete(NextInterceptor, DeleteOperationContext )}. */ void delete( DeleteOperationContext opContext ) throws Exception; /** * Calls the next interceptor's {@link Interceptor#add( NextInterceptor, AddOperationContext )}. */ void add( AddOperationContext opContext ) throws Exception; /** * Calls the next interceptor's {@link Interceptor#modify( NextInterceptor, ModifyOperationContext )}. */ void modify( ModifyOperationContext opContext ) throws Exception; /** * Calls the next interceptor's {@link Interceptor#list( NextInterceptor, ListOperationContext )}. */ EntryFilteringCursor list( ListOperationContext opContext ) throws Exception; /** * Calls the next interceptor's {@link Interceptor#search( NextInterceptor, SearchOperationContext opContext )}. */ EntryFilteringCursor search( SearchOperationContext opContext ) throws Exception; /** * Calls the next interceptor's {@link Interceptor#lookup( NextInterceptor, LookupOperationContext )}. */ ClonedServerEntry lookup( LookupOperationContext opContext ) throws Exception; /** * Calls the next interceptor's {@link Interceptor#hasEntry( NextInterceptor, EntryOperationContext )}. */ boolean hasEntry( EntryOperationContext opContext ) throws Exception; /** * Calls the next interceptor's {@link Interceptor#rename( NextInterceptor, RenameOperationContext )}. */ void rename( RenameOperationContext opContext ) throws Exception; /** * Calls the next interceptor's {@link Interceptor#move( NextInterceptor, MoveOperationContext )}. */ void move( MoveOperationContext opContext ) throws Exception; /** * Calls the next interceptor's {@link Interceptor#moveAndRename( NextInterceptor, MoveAndRenameOperationContext )}. */ void moveAndRename( MoveAndRenameOperationContext opContext ) throws Exception; /** * Calls the next interceptor's {@link Interceptor#bind( NextInterceptor, BindOperationContext )} */ void bind( BindOperationContext opContext ) throws Exception; /** * Calls the next interceptor's {@link Interceptor#unbind( NextInterceptor, UnbindOperationContext )} */ void unbind( UnbindOperationContext opContext ) throws Exception; } |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/integ/state/AbstractState.java | ApacheDS Core Integration | 84 |
org/apache/directory/server/integ/state/AbstractState.java | ApacheDS Server Integration | 84 |
public void create( InheritableServerSettings settings ) throws NamingException { } /** * Action where an attempt is made to destroy the service. This * entails nulling out reference to it and triggering garbage * collection. */ public void destroy() { LOG.error( DESTROY_ERR ); throw new IllegalStateException( DESTROY_ERR ); } /** * Action where an attempt is made to erase the contents of the * working directory used by the service for various files including * partition database files. * * @throws IOException on errors while deleting the working directory */ public void cleanup() throws IOException { LOG.error( CLEANUP_ERROR ); throw new IllegalStateException( CLEANUP_ERROR ); } /** * Action where an attempt is made to start up the service. * * @throws Exception on failures to start the core directory service */ public void startup() throws Exception { LOG.error( STARTUP_ERR ); throw new IllegalStateException( STARTUP_ERR ); } /** * Action where an attempt is made to shutdown the service. * * @throws Exception on failures to stop the core directory service */ public void shutdown() throws Exception { LOG.error( SHUTDOWN_ERR ); throw new IllegalStateException( SHUTDOWN_ERR ); } /** * Action where an attempt is made to run a test against the service. * * All annotations should have already been processed for * InheritableServerSettings yet they and others can be processed since we have * access to the method annotations below * * @param testClass the class whose test method is to be run * @param testMethod the test method which is to be run * @param notifier a notifier to report failures to * @param settings the inherited settings and annotations associated with * the test method */ public void test( TestClass testClass, TestMethod testMethod, RunNotifier notifier, InheritableServerSettings settings ) |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/schema/SchemaPartitionDao.java | ApacheDS Core | 764 |
org/apache/directory/server/core/schema/SchemaPartitionDao.java | ApacheDS Core | 936 |
or.addNode( new EqualityNode<String>( M_SUP_OBJECT_CLASS_OID, new ClientStringValue( oc.getOid() ) ) ); filter.addNode( or ); SearchControls searchControls = new SearchControls(); searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE ); EntryFilteringCursor cursor = null; try { cursor = partition.search( new SearchOperationContext( null, partition.getSuffixDn(), AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) ); while ( cursor.next() ) { set.add( cursor.get() ); } } finally { if ( cursor != null ) { cursor.close(); } } return set; } |
File | Project | Line |
---|---|---|
org/apache/directory/server/core/entry/DefaultServerEntry.java | ApacheDS Core Entry | 1715 |
org/apache/directory/server/core/entry/DefaultServerEntry.java | ApacheDS Core Entry | 1845 |
public boolean remove( AttributeType attributeType, Value<?>... values ) throws NamingException { try { EntryAttribute attribute = attributes.get( attributeType ); if ( attribute == null ) { // Can't remove values from a not existing attribute ! return false; } int nbOldValues = attribute.size(); // Remove the values attribute.remove( values ); if ( attribute.size() == 0 ) { // No mare values, remove the attribute attributes.remove( attributeType ); return true; } if ( nbOldValues != attribute.size() ) { // At least one value have been removed, return true. return true; } else { // No values have been removed, return false. return false; } } catch ( IllegalArgumentException iae ) { LOG.error( "The removal of values for the missing '{}' attribute is not possible", attributeType ); return false; } } public List<EntryAttribute> remove( EntryAttribute... attributes ) throws NamingException |