database.sarang.net
UserID
Passwd
Database
DBMS
MySQL
PostgreSQL
Firebird
Oracle
Informix
Sybase
MS-SQL
DB2
Cache
CUBRID
ㆍLDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
LDAP Q&A 2192 게시물 읽기
No. 2192
LDAP SDK이용시 한글이 입력안되는 현상
작성자
초보자
작성일
2005-08-01 23:11
조회수
7,806

고수님들 코멘트 부탁드립니다.

--------------------------------------

소스상의

"ou=테스트, ou=resources, o=itnade,c=kr" 에 영문을 넣으면 되는데 한글은 안되네요

 

에러내용입니다.

ldap_add_ext_s: Invalid DN syntax
invalid DN

--------------------------------------

 

 

 

#include <stdio.h>
#include "ldap.h"
/* Change these as needed. */
#define HOSTNAME "localhost"
#define PORTNUMBER 50000
#define BIND_DN "cn=Manager,o=itnade,c=kr"
#define BIND_PW "secret"
#define NEW_DN "ou=테스트, ou=resources, o=itnade,c=kr"
#define NUM_MODS 3

int main( int argc, char **argv )
{

LDAP *ld;

LDAPMod **mods;

char *matched_msg = NULL, *error_msg = NULL;

int i, rc;

char *object_vals[] = { "top", "organizationalUnit", NULL };

char *attribute_vals[] = { "테스트",NULL };

int version = LDAP_VERSION3;

/* Get a handle to an LDAP connection. */

if ( (ld = ldap_init( HOSTNAME, PORTNUMBER )) == NULL ) {

perror( "ldap_init" );

return( 1 );

}

/* Bind to the server as the Directory Manager. */

(void) ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION,&version );
rc = ldap_simple_bind_s( ld, BIND_DN, BIND_PW );

if ( rc != LDAP_SUCCESS ) {

fprintf( stderr, "ldap_simple_bind_s: %s\n", ldap_err2string( rc ) );

ldap_get_lderrno( ld, &matched_msg, &error_msg );

if ( error_msg != NULL && *error_msg != '\0' ) {

fprintf( stderr, "%s\n", error_msg );

}

if ( matched_msg != NULL && *matched_msg != '\0' ) {

fprintf( stderr,

"Part of the DN that matches an existing entry: %s\n",

matched_msg );

}

ldap_unbind_s( ld );

return( 1 );

}
printf("2\n");
/* Construct the array of LDAPMod structures representing the attributes

of the new entry. */

mods = ( LDAPMod ** ) malloc(( NUM_MODS + 1 ) * sizeof( LDAPMod * ));

if ( mods == NULL ) {

fprintf( stderr, "Cannot allocate memory for mods array\n" );

exit( 1 );

}

for ( i = 0; i < NUM_MODS; i++ ) {

if (( mods[ i ] = ( LDAPMod * ) malloc( sizeof( LDAPMod ))) == NULL ) {

fprintf( stderr, "Cannot allocate memory for mods element\n" );

exit( 1 );

}

}
printf("3\n");

mods[0]->mod_op = 0;

mods[0]->mod_type = "objectclass";

mods[0]->mod_values = object_vals;

mods[1]->mod_op = 0;

mods[1]->mod_type = "ou";

mods[1]->mod_values = attribute_vals;

mods[2] = NULL ;

/* Perform the add operation. */

rc = ldap_add_ext_s( ld, NEW_DN, mods, NULL, NULL );

if ( rc != LDAP_SUCCESS ) {

fprintf( stderr, "ldap_add_ext_s: %s\n", ldap_err2string( rc ) );

ldap_get_lderrno( ld, &matched_msg, &error_msg );

if ( error_msg != NULL & *error_msg != '\0' ) {

fprintf( stderr, "%s\n", error_msg );

}

if ( matched_msg != NULL && *matched_msg != '\0' ) {

fprintf( stderr,

"Part of the DN that matches an existing entry: %s\n",

matched_msg );

}

} else {

printf( "%s added successfully.\n", NEW_DN );

}
printf("4\n");
ldap_unbind_s( ld );

for ( i = 0; i < NUM_MODS; i++ ) {

free( mods[ i ] );

}

free( mods );

return 0;

}

이 글에 대한 댓글이 총 1건 있습니다.

소스상에는 아마 EUC-KR로 되어 있어서 그럴겁니다. LDAP에 입력을 할때 문자열을 EUC-KR로 변경후에 입력을 하셔야 합니다.

 

그럼

송상준(sjsong)님이 2005-08-02 14:31에 작성한 댓글입니다.
[Top]
No.
제목
작성자
작성일
조회
2196ONE_LEVEL_SCOPE에서... [3]
황은경
2005-08-12
7028
2194subtree 삭제방법이 궁금합니다. [3]
이상준
2005-08-08
7245
2193한글뒤에 이상한글자가 보이는 현상??? [4]
김자우
2005-08-04
8507
2192LDAP SDK이용시 한글이 입력안되는 현상 [1]
초보자
2005-08-01
7806
2191BMC 통합 사용자 계정관리 솔루션 세미나"에 귀하를 초대합니다.
이동림
2005-08-01
8149
2190AD속성중 memberOf에 대해서... [1]
사오정
2005-08-01
8187
2188slapd실행시 에러 [1]
이상준
2005-07-27
7378
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2023 DSN, All rights reserved.
작업시간: 0.054초, 이곳 서비스는
	PostgreSQL v16.1로 자료를 관리합니다