|
¡û ¤Ï¤¸¤á¤Ë
º£²ó¤Ï¡¢LDAP ¥µ¡¼¥Ð¤ËÀܳ¤·¤Æ¥Ç¥£¥ì¥¯¥È¥ê¥¨¥ó¥È¥ê¤òÅÐÏ¿¤¹¤ë¡¢¤¢¤ë¤¤¤Ï¥Ç¥£¥ì¥¯¥È¥ê¥¨¥ó¥È¥ê¤òºï½ü¤¹¤ëÊýË¡¤Ë¤Ä¤¤¤ÆÀâÌÀ¤·¤Þ¤¹¡£ÅÐÏ¿¤µ¤ì¤¿¥¨¥ó¥È¥ê¤Î³Îǧ¡¢¤¢¤ë¤¤¤Ïºï½ü¤µ¤ì¤¿¤³¤È¤Î³Îǧ¤Ë»ÈÍѤ¹¤ë¸¡º÷½èÍý¤Ë¤Ä¤¤¤Æ¤Ï¼¡²óÀâÌÀ¤·¤Þ¤¹¡£¤³¤³¤Ç¤Ï LDAP ¥µ¡¼¥Ð¦¡¢¤¢¤ë¤¤¤Ï LDAP ¥µ¡¼¥Ð¤ËÉÕ¤¤¤Æ¤¤¤ë¥Ä¡¼¥ë¤Ê¤É¤Ç³Îǧ¤·¤Æ¤â¤é¤¨¤ì¤Ð¤È»×¤¤¤Þ¤¹¡£
¡û ¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à
LDAP ¥µ¡¼¥Ð¤ËÀܳ¤·¡¢»ØÄꤵ¤ì¤¿ DN ¤ò»È¤Ã¤Æ¥Ç¥£¥ì¥¯¥È¥ê¥¨¥ó¥È¥ê¤òÅÐÏ¿¡¢¤¢¤ë¤¤¤Ïºï½ü¤¹¤ë¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à LDAPAddDel.java ¤Ç¤¹¡£ÅÐÏ¿¤¹¤ë¥Ç¥£¥ì¥¯¥È¥ê¥¨¥ó¥È¥ê¤Î°ÀÆâÍƤϸÇÄê¤Ç¤¹¡£
¥³¥ó¥Ñ¥¤¥ë¤¬½ªÎ»¤·¤¿¤é
java LDAPAddDel [LDAP¥µ¡¼¥Ð̾/IP¥¢¥É¥ì¥¹] \ [bind¥æ¡¼¥¶¤ÎDN] \ [bind¥æ¡¼¥¶¤Î¥Ñ¥¹¥ï¡¼¥É] \ [add(ÄɲÃ) / del(ºï½ü)] \ [¥¨¥ó¥È¥ê¤Î DN]
¤Ç¼Â¹Ô¤Ç¤¹¡£Àµ¾ï¤Ë½èÍý¤¬½ªÎ»¤·¤¿¾ì¹ç¤Ï¤½¤Î»Ý¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£²¿¤é¤«¤ÎÎã³°¤¬È¯À¸¤·¤¿¤é¡¢¤½¤ÎÆâÍƤ¬É½¼¨¤µ¤ì¤Þ¤¹¡£
¤Ê¤ª¡¢¤Ï¤¸¤á¤Ë ¤Î¥Ú¡¼¥¸¤«¤éÁ´¤Æ¤Î¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤ò¸Ç¤á¤¿ tar ¥Ü¡¼¥ë¤ò¥À¥¦¥ó¥í¡¼¥É¤¹¤ë¤³¤È¤â¤Ç¤¤Þ¤¹¡£
--- LDAPAddDel.java ---
1 import org.ietf.ldap.LDAPAttribute; 2 import org.ietf.ldap.LDAPAttributeSet; 3 import org.ietf.ldap.LDAPConnection; 4 import org.ietf.ldap.LDAPEntry; 5 import org.ietf.ldap.LDAPException; 6 7 8 /** 9 * LDAP ¥µ¡¼¥Ð¤ËÀܳ¤·¡¢»ØÄꤵ¤ì¤¿ DN ¤Ç¥¨¥ó¥È¥ê¤òÅÐÏ¿¤¹¤ë¡£ 10 * ¤¢¤ë¤¤¤Ï»ØÄê DN ¤Î¥¨¥ó¥È¥ê¤òºï½ü¤¹¤ë¡£¥¨¥ó¥È¥êÅÐÏ¿»þ¤Î°ÀÃÍ¤Ë 11 * ¤Ä¤¤¤Æ¤Ï¡¢ËÜ¥¯¥é¥¹ÆâÉô¤Ç¸ÇÄê¤ÎÆâÍÆ¡£ 12 * 13 * @version 19 May 2002 14 * @author Ryo Ichinose 15 */ 16 public class LDAPAddDel 17 { 18 /** 19 * LDAP Protocol Version 3 20 */ 21 public static final int LDAP_V3 = 3; // LDAPv3 22 23 24 /** 25 * LDAP ¥µ¡¼¥Ð¤ËÀܳ¤·¡¢»ØÄꤵ¤ì¤¿ DN ¤Ç¥¨¥ó¥È¥ê¤òÅÐÏ¿¤¹¤ë¡£ 26 * ¥¨¥ó¥È¥êÅÐÏ¿»þ¤Î°ÀÃͤˤĤ¤¤Æ¤Ï¸ÇÄê¤ÎÆâÍÆ¡£ 27 * 28 * @param host ¥Û¥¹¥È̾¤â¤·¤¯¤Ï IP¥¢¥É¥ì¥¹ 29 * @param binddn bind ¥æ¡¼¥¶¤Î DN 30 * @param bindpw bind ¥æ¡¼¥¶¤Î¥Ñ¥¹¥ï¡¼¥É 31 * @param dn ÅÐÏ¿¥¨¥ó¥È¥ê¤Î DN 32 */ 33 public void add( String host, String binddn, String bindpw, String dn ) 34 { 35 // ÅÐÏ¿¤¹¤ë¥¨¥ó¥È¥ê¤Î³Æ°ÀÃͤòÀßÄꤹ¤ë¡£ 36 LDAPAttributeSet attrset = new LDAPAttributeSet(); 37 38 39 // posixAccount ¤Îɬ¿Ü°À 40 String objcls[] = { "posixAccount" }; 41 String cn[] = { "name1" }; 42 String uid[] = { "123456" }; 43 String uidnum[] = { "501" }; 44 String gidnum[] = { "502" }; 45 String home[] = { "/home/123456" }; 46 47 attrset.add( new LDAPAttribute( "objectclass", objcls ) ); 48 attrset.add( new LDAPAttribute( "cn", cn ) ); 49 attrset.add( new LDAPAttribute( "uid", uid ) ); 50 attrset.add( new LDAPAttribute( "uidNumber", uidnum ) ); 51 attrset.add( new LDAPAttribute( "gidNumber", gidnum ) ); 52 attrset.add( new LDAPAttribute( "homeDirectory", home ) ); 53 54 55 // DN ¤È°ÀÃͤÇÅÐÏ¿¤¹¤ë¥¨¥ó¥È¥ê¤ò LDAPEntry ¤Î¥¤¥ó¥¹¥¿¥ó¥¹ 56 // ¤È¤·¤ÆºîÀ®¡£ 57 LDAPEntry entry = new LDAPEntry( dn, attrset ); 58 LDAPConnection lc = new LDAPConnection(); 59 60 try { 61 // LDAP ¥µ¡¼¥Ð¤ËÀܳ¤¹¤ë¡£¥Ý¡¼¥È¤Ï¥Ç¥Õ¥©¥ë¥È(389ÈÖ)¤ò»È¤¦¡£ 62 lc.connect( host, LDAPConnection.DEFAULT_PORT ); 63 System.out.println( "Connected to " + host ); 64 System.out.println(); 65 66 67 // »ØÄꤵ¤ì¤¿ DN ¤ª¤è¤Ó¥Ñ¥¹¥ï¡¼¥É¤Ç¥Ð¥¤¥ó¥É(ǧ¾Ú)¤¹¤ë¡£ 68 // ¤³¤ì¤ò¼Â¹Ô¤·¤Ê¤¤¾ì¹ç¡¢anonymous ¾õÂÖ¤ÇÁàºî¤¹¤ë¤³¤È¤Ë¤Ê¤ë¡£ 69 lc.bind( LDAPAddDel.LDAP_V3, binddn, bindpw ); 70 71 72 // »ØÄꥨ¥ó¥È¥ê¤ÎÅÐÏ¿¤ò¼Â¹Ô¤¹¤ë¡£ 73 lc.add( entry ); 74 System.out.println( "Successfully added" ); 75 76 // Àܳ¤òÀÚÃǤ¹¤ë¡£ 77 lc.disconnect(); 78 System.out.println(); 79 System.out.println( "Disconnected" ); 80 } 81 catch( LDAPException e ) { 82 System.out.println( "LDAPException occured : " + 83 e.toString() ); 84 } 85 } 86 87 88 /** 89 * LDAP ¥µ¡¼¥Ð¤ËÀܳ¤·¡¢»ØÄꤵ¤ì¤¿ DN ¤Î¥¨¥ó¥È¥ê¤òºï½ü¤¹¤ë¡£ 90 * 91 * @param host ¥Û¥¹¥È̾¤â¤·¤¯¤Ï IP¥¢¥É¥ì¥¹ 92 * @param binddn bind ¥æ¡¼¥¶¤Î DN 93 * @param bindpw bind ¥æ¡¼¥¶¤Î¥Ñ¥¹¥ï¡¼¥É 94 * @param dn ºï½ü¥¨¥ó¥È¥ê¤Î DN 95 */ 96 public void del( String host, String binddn, String bindpw, String dn ) 97 { 98 LDAPConnection lc = new LDAPConnection(); 99 100 try { 101 // LDAP ¥µ¡¼¥Ð¤ËÀܳ¤¹¤ë¡£¥Ý¡¼¥È¤Ï¥Ç¥Õ¥©¥ë¥È(389ÈÖ)¤ò»È¤¦¡£ 102 lc.connect( host, LDAPConnection.DEFAULT_PORT ); 103 System.out.println( "Connected to " + host ); 104 System.out.println(); 105 106 107 // »ØÄꤵ¤ì¤¿ DN ¤ª¤è¤Ó¥Ñ¥¹¥ï¡¼¥É¤Ç¥Ð¥¤¥ó¥É(ǧ¾Ú)¤¹¤ë¡£ 108 // ¤³¤ì¤ò¼Â¹Ô¤·¤Ê¤¤¾ì¹ç¡¢anonymous ¾õÂÖ¤ÇÁàºî¤¹¤ë¤³¤È¤Ë¤Ê¤ë¡£ 109 lc.bind( LDAPAddDel.LDAP_V3, binddn, bindpw ); 110 111 // »ØÄꥨ¥ó¥È¥ê¤ÎÅÐÏ¿¤ò¼Â¹Ô¤¹¤ë¡£ 112 lc.delete( dn ); 113 System.out.println( "Successfully deleted" ); 114 115 // Àܳ¤òÀÚÃǤ¹¤ë¡£ 116 lc.disconnect(); 117 118 System.out.println(); 119 System.out.println( "Disconnected" ); 120 } 121 catch( LDAPException e ) { 122 System.out.println( "LDAPException occured : " + 123 e.toString() ); 124 } 125 } 126 127 128 /** 129 * ¥¨¥ó¥È¥ê¥Ý¥¤¥ó¥È 130 * 131 * @param args 132 * <ul> 133 * <li>args[0] --- ¥Û¥¹¥È̾¤â¤·¤¯¤Ï IP ¥¢¥É¥ì¥¹ 134 * <li>args[1] --- bind ¥æ¡¼¥¶¤Î DN 135 * <li>args[2] --- bind ¥æ¡¼¥¶¤Î¥Ñ¥¹¥ï¡¼¥É 136 * <li>args[3] --- ÅÐÏ¿( add )/ºï½ü( del ) 137 * <li>args[4] --- ÅÐÏ¿/ºï½ü¥¨¥ó¥È¥ê¤Î DN 138 * </ul> 139 */ 140 public static void main( String[] args ) 141 { 142 LDAPAddDel obj = new LDAPAddDel(); 143 144 if ( args[3].equals( "add" ) ) { 145 obj.add( args[0], args[1], args[2], args[4] ); 146 } 147 else if ( args[3].equals( "del" ) ) { 148 obj.del( args[0], args[1], args[2], args[4] ); 149 } 150 } 151 }
¡û ¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤ÎÀâÌÀ
¤Ç¤Ï¡¢¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤Ë¤Ä¤¤¤ÆÀâÌÀ¤·¤Æ¤¤¤¤Þ¤¹¡£
- 1 ¡Á 5 ¹ÔÌÜ
»ÈÍѤ¹¤ë¥¯¥é¥¹¥é¥¤¥Ö¥é¥ê¤Î¥Ñ¥Ã¥±¡¼¥¸»ØÄê¤ò¹Ô¤Ã¤Æ¤¤¤Þ¤¹¡£LDAPAddDel.java ¤Ç¤Ï¡¢Á°²ó¤Î LDAPConnect.java ¤Ç»ÈÍѤ·¤¿¥¯¥é¥¹¤Î¾¤Ë¡¢LDAPAttribute¡¢LDAPAttributeSet¡¢LDAPEntry ¤Î 3 ¤Ä¤Î¥¯¥é¥¹¤ò¿·¤¿¤Ë»ÈÍѤ·¤Þ¤¹¡£
- 24 ¡Á 85 ¹ÔÌÜ ( LDAPAddDel#add() )
LDAPAddDel#add() ¥á¥½¥Ã¥É¤Ç¡¢¥Ç¥£¥ì¥¯¥È¥ê¥¨¥ó¥È¥ê¤ÎÅÐÏ¿½èÍý¤ò¹Ô¤¤¤Þ¤¹¡£³Æ¥ö½ê¤Ë¤Ä¤¤¤Æ °Ê¹ß¤ÇÀâÌÀ¤·¤Þ¤¹¡£
- 35 ¡Á 36 ¹ÔÌÜ
ÅÐÏ¿¤¹¤ë¥Ç¥£¥ì¥¯¥È¥ê¥¨¥ó¥È¥ê¤ËÀßÄꤹ¤ë°À¤ª¤è¤Ó°ÀÃͤÎÁȤò³ÊǼ¤¹¤ë¤¿¤á¤Ë¡¢ LDAPAttributeSet ¥¯¥é¥¹¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®¤·¤Æ¤¤¤Þ¤¹¡£LDAPAttributeSet ¥¯¥é¥¹¤Ë¤Ï¡¢ Ê£¿ô¤Î LDAPAttribute ¥¯¥é¥¹¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤ò³ÊǼ¤¹¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£LDAPAttribute ¥¯¥é¥¹¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤¬³Æ¡¹¤Î°À̾¤ª¤è¤Ó°ÀÃͤξðÊó¤òÊÝ»ý¤·¤Þ¤¹¡£
- 39 ¡Á 52 ¹ÔÌÜ
ÅÐÏ¿¤¹¤ë¥Ç¥£¥ì¥¯¥È¥ê¥¨¥ó¥È¥ê¤ËÀßÄꤹ¤ë°À¤ª¤è¤Ó°ÀÃͤÎÁȤò LDAPAttributeSet ¥¯¥é¥¹ ¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤Ë³ÊǼ¤¹¤ë¤Þ¤Ç¤Î½èÍý¤ò¹Ô¤Ã¤Æ¤¤¤Þ¤¹¡£¤³¤³¤Ç¤Ï posixAccount ¤È¤¤¤¦¥ª¥Ö¥¸¥§¥¯¥È¥¯¥é¥¹¤Ç¥Ç¥£¥ì¥¯¥È¥ê¥¨¥ó¥È¥ê¤òÅÐÏ¿¤·¤Þ¤¹¡£
posixAccount ¤È¤¤¤¦¥ª¥×¥¸¥§¥¯¥È¥¯¥é¥¹¤Ï RFC 2307 ¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£ ¤³¤ì¤Ë¤è¤ë¤È¡¢cn¡¢uid¡¢uidNumber¡¢gidNumber¡¢homeDirectory ¤È¤¤¤¦Â°À¤Ïɬ¿Ü¤Ç¤¢¤ë¤È ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£¤è¤Ã¤Æ¤³¤ì¤é¤Î°À¤ËÂФ¹¤ëÃͤò 40 ¡Á 45 ¹ÔÌܤǤ½¤ì¤¾¤ì String ¤ÎÇÛÎó ¤È¤·¤ÆºîÀ®¤·¤Æ¤¤¤Þ¤¹( objectclass ¤È¤¤¤¦Â°À¤ÏÁ´¤Æ¤Î¥¨¥ó¥È¥ê¤Çɬ¿Ü )¡£
²¿¸ÎÇÛÎ󤫤Ȥ¤¤¦¤È¡¢Â°À̾¤ÈÃͤξðÊó¤ò¼ÂºÝ¤ËÊÝ»ý¤¹¤ë LDAPAttribute ¥¯¥é¥¹¤Î ¥³¥ó¥¹¥È¥é¥¯¥¿¤¬¤½¤ì¤òÍ׵ᤷ¤Æ¤¤¤ë¤«¤é¤Ç¤¹¡£ ¤³¤ì¤Ï¡¢³Æ¡¹¤Î°À¤¬Ê£¿ô¤Î°ÀÃͤò»ý¤Ä¤³¤È¤¬¤Ç¤¤ë¤¿¤á¤Ç¤¹¡£¤è¤Ã¤Æ¡¢Â°ÀÃͤ¬ 1 ¤Ä¤Î¾ì¹ç¤Ç¤âÇÛÎó¤È¤·¤Æ°·¤¦É¬Íפ¬¤¢¤ê¤Þ¤¹¡£
47 ¡Á 52 ¹ÔÌܤǡ¢Â°À̾¤È°ÀÃͤò°ú¿ô¤È¤·¤Æ LDAPAttribute ¥¯¥é¥¹¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤ò ºîÀ®¤·¤¿¾å¤Ç¡¢¤½¤ì¤ò LDAPAttributeSet ¥¯¥é¥¹¤Î¥¤¥ó¥¹¥¿¥ó¥¹ ¤¬ÊÝ»ý¤¹¤ëÍ×ÁÇ¤Ë Äɲ䷤Ƥ¤¤Þ¤¹¡£
- 55 ¡Á 57 ¹ÔÌÜ
ɬÍפÊ°À̾¤È°ÀÃͤξðÊó¤ò³ÊǼ¤·¤¿ LDAPAttributeSet ¥¯¥é¥¹¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤ÈÅÐÏ¿ ¤¹¤ë¥¨¥ó¥È¥ê¤Î DN ¤ò»ØÄꤷ¤Æ¡¢ LDAPEntry ¥¯¥é¥¹¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®¤·¤Æ¤¤¤Þ¤¹¡£JLDAP (°Ê³°¤Î Directory SDK ¤Ç¤â¿ʬƱÍÍ)¤Ç¥Ç¥£¥ì¥¯¥È¥ê¥¨¥ó¥È¥ê¤òÅÐÏ¿¤¹¤ë¾ì¹ç¤Ï¡¢¤³¤Î LDAPEntry ¥¯¥é¥¹¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤¬ÅÐÏ¿¤¹¤ëñ°Ì¤È¤Ê¤ê¤Þ¤¹¡£
- 72 ¡Á 74 ¹ÔÌÜ
LDAPEntry ¥¯¥é¥¹¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤ò»È¤Ã¤Æ¡¢LDAP ¥µ¡¼¥Ð¤Ë¥Ç¥£¥ì¥¯¥È¥ê¥¨¥ó¥È¥ê¤òÅÐÏ¿ ¤·¤Æ¤¤¤Þ¤¹¡£¥¨¥ó¥È¥ê¤òÅÐÏ¿¤¹¤ë¤Ë¤Ï¡¢LDAPConnection#add() ¥á¥½¥Ã¥É¤ò»ÈÍѤ·¤Þ¤¹¡£
public void LDAPConnection#add( LDAPEntry entry ) throws LDAPException entry : ÅÐÏ¿¤¹¤ë¥¨¥ó¥È¥ê¾ðÊó
²¿¤é¤«¤ÎÍýͳ¤ÇÅÐÏ¿¤Ë¼ºÇÔ¤·¤¿¾ì¹ç¡¢LDAPException ¤¬ throw ¤µ¤ì¤Þ¤¹¡£LDAPException ¤Î ÆâÍƤˤĤ¤¤Æ¤Ï¸å½Ò¤·¤Þ¤¹¡£
add() ¥á¥½¥Ã¥É¤Ï¾å¤Î·Á¼°°Ê³°¤Î·Á¤Ç¤¤¤¯¤Ä¤«¥ª¡¼¥Ð¡¼¥í¡¼¥É¤µ¤ì¤Æ¤¤¤Þ¤¹¡£¤½¤ì¤¾¤ì¤Î ¾ÜºÙ¤Ë¤Ä¤¤¤Æ¤Ï JLDAP ¤Î API ¥É¥¥å¥á¥ó¥È¤ò»²¾È¤·¤Æ²¼¤µ¤¤¡£
- 81 ¡Á 84 ¹ÔÌÜ
¤³¤³¤Þ¤Ç¤Î½èÍý¤ÇȯÀ¸¤·¤¿ LDAPException ¤ò catch ¤·¤Æ¡¢ÆâÍƤòɽ¼¨¤·¤Æ¤¤¤Þ¤¹¡£¤³¤³¤Þ¤Ç ¤Î¿·¤¿¤Ê½èÍý¤Ë¤è¤Ã¤ÆȯÀ¸¤¹¤ë²ÄǽÀ¤Î¤¢¤ëÎã³°ÆâÍƤˤĤ¤¤Æ¡¢¼«Ê¬¤¬³Îǧ¤Ç¤¤¿ÈÏ°Ï ¤Ç°Ê²¼¤Ë¤Þ¤È¤á¤Æ¤ª¤¤Þ¤¹¡£¤³¤ì¤ÇÁ´¤Æ¤È¤¤¤¦°ÕÌ£¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£
ÈÖ¹æ ¥¨¥é¡¼¥³¡¼¥É¤ÎÄê¿ô̾(LDAPException.XXX ¤Î·Á¤Ç»²¾È²Ä) ÆâÍÆ 17 UNDEFINED_ATTRIBUTE_TYPE »ØÄꤵ¤ì¤¿Â°À¤¬ LDAP ¥µ¡¼¥Ð¦¤Î¥¹¥¡¼¥Þ¤Ë¸ºß¤·¤Ê¤¤¡£¤Ä¤Þ¤ê¡¢LDAPAttributeSet ¥¯¥é¥¹¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤ËÀßÄꤷ¤¿Â°À̾¤¬Àµ¤·¤¯¤Ê¤¤¤³¤È¤òɽ¤·¤Æ¤¤¤ë¡£»ÈÍѤ·¤¿¥ª¥Ö ¥¸¥§¥¯¥È¥¯¥é¥¹(¤³¤³¤Ç¤Ï posixAccount )¤¬¡¢ÂоݤΠLDAP ¥µ¡¼¥Ð¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤Ê¤¤ ²ÄǽÀ¤â¤¢¤ë¡£ 32 NO_SUCH_OBJECT add() ¤Ë»ØÄꤷ¤¿ DN ¤Ç¼±Ê̤µ¤ì¤ë¥ª¥Ö¥¸¥§¥¯¥È¤ò»²¾È¤¹¤ë¤³¤È¤¬¤Ç¤¤Ê¤¤¡£ÅÐÏ¿¤¹¤ë DN ¤¬Â¸ºß¤·¤Ê¤¤¤Î¤Ï¤¢¤ë°ÕÌ£ÅöÁ³¤Ç¡¢¤³¤³¤ÇȯÀ¸¤¹¤ë¤Î¤Ï DN ¤òÅÐÏ¿¤¹¤ë¤¿¤á¤Î¥Ç¥£ ¥ì¥¯¥È¥ê¤¬Â¸ºß¤·¤Ê¤¤¤³¤È¤ò°ÕÌ£¤·¤Æ¤¤¤ë¡£²¾¤Ë "uid=foo,ou=people,dc=sample,dc=jp" ¤È¤¤¤¦ DN ¤Ç¥¨¥ó¥È¥ê¤òÅÐÏ¿¤·¤è¤¦¤È¤·¤Æ¤¤¤¿¤Ê¤é¡¢"ou=people,dc=sample,dc=jp" ¤È¤¤¤¦ DN ¤Ç¼±Ê̤µ¤ì¤ë¥Ç¥£¥ì¥¯¥È¥ê¤¬Â¸ºß¤·¤Ê¤¤¤³¤È¤òɽ¤·¤Æ¤¤¤ë¡£ 34 INVALID_DN_SYNTAX »ØÄꤷ¤¿ DN ¤Î¹½Ê¸¤¬Àµ¤·¤¯¤Ê¤¤¡£ 65 OBJECT_CLASS_VIOLATION ¥ª¥Ö¥¸¥§¥¯¥È¥¯¥é¥¹¤ËŬÍѤµ¤ì¤ëµ¬Â§¤ËÈ¿¤·¤¿½èÍý¤ò¹Ô¤ª¤¦¤È¤·¤Æ¤¤¤ë¡£É¬¿Ü°À¤ÎÃÍ ¤ò»ØÄꤻ¤º¤Ë¥¨¥ó¥È¥ê¤òÄɲä·¤¿¡¢ÄêµÁ¤µ¤ì¤Æ¤¤¤Ê¤¤Â°À¤ÈÃͤòÀßÄꤷ¤Æ¥¨¥ó¥È¥ê¤òÄÉ ²Ã/½¤Àµ¤·¤¿¡¢É¬¿Ü°À¤òºï½ü¤·¤è¤¦¤È¤·¤¿¡¢¤Ê¤É¤Î¾ì¹ç¤ËȯÀ¸¤¹¤ë¡£
- 88 ¡Á 125 ¹ÔÌÜ ( LDAPAddDel#del() )
LDAPAddDel#del() ¥á¥½¥Ã¥É¤Ç»ØÄꥨ¥ó¥È¥ê¤Îºï½ü¤ò¹Ô¤¤¤Þ¤¹¡£¿·¤·¤¤Éôʬ¤Ï 113 ¹ÔÌܤΠlc.delete( dn ); ¤È¤¤¤¦½ê¤Î¤ß¤Ç¤¹¡£¥¨¥ó¥È¥ê¤Îºï½ü¤Ë¤Ï¡¢LDAPConnection#delete() ¤ò»È¤¤¤Þ¤¹¡£
public void LDAPConnection#delete( String dn ) throws LDAPException dn : ºï½ü¤¹¤ë¥¨¥ó¥È¥ê¤ò¼¨¤¹ DN
²¿¤é¤«¤ÎÍýͳ¤Çºï½ü¤Ë¼ºÇÔ¤·¤¿¾ì¹ç¡¢LDAPException ¤¬ throw ¤µ¤ì¤Þ¤¹¡£¼«Ê¬¤Ç³Îǧ¤·¤¿ÈÏ°Ï ¤Ç¤Ï¡¢°Ê²¼¤ÎÎã³°ÆâÍƤ¬È¯À¸¤·¤Þ¤¹¡£¤Ê¤ª¡¢¤³¤ì¤¬Á´¤Æ¤È¤¤¤¦°ÕÌ£¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£
ÈÖ¹æ ¥¨¥é¡¼¥³¡¼¥É¤ÎÄê¿ô̾(LDAPException.XXX ¤Î·Á¤Ç»²¾È²Ä) ÆâÍÆ 32 NO_SUCH_OBJECT delete() ¤Ë»ØÄꤷ¤¿ DN ¤Ç¼±Ê̤µ¤ì¤ë¥ª¥Ö¥¸¥§¥¯¥È¤ò»²¾È¤¹¤ë¤³¤È¤¬¤Ç¤¤Ê¤¤¡£ ¤Ä¤Þ¤ê¡¢»ØÄꤷ¤¿¥¨¥ó¥È¥ê¤¬Â¸ºß¤·¤Ê¤¤¤È¤¤¤¦¤³¤È¤Ç¤¢¤ë¡£ 34 INVALID_DN_SYNTAX delete() ¤Ë»ØÄꤷ¤¿ DN ¤Î¹½Ê¸¤¬Àµ¤·¤¯¤Ê¤¤¡£
°Ê¾å¤Ç LDAPAddDel.java ¤Ë¤Ä¤¤¤Æ¤ÎÀâÌÀ¤Ï½ª¤ï¤ê¤Ç¤¹¡£¼¡¤ÏºÇ¤â»ÈÍѤµ¤ì¤ë¤È»×¤ï¤ì¤ë¥Ç¥£¥ì¥¯¥È¥ê¥¨¥ó¥È¥ê¤Î¸¡º÷½èÍý¤Ë¤Ä¤¤¤ÆÀâÌÀ¤·¤Æ¤¤¤¤Þ¤¹¡£