mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-21 07:09:34 -05:00
Cleanup:
Fix printf formats, remove unused variables, add missing prototypes in slapd, add static/const, add some return types or change to void return type.
This commit is contained in:
parent
1886192447
commit
c09a2c63e7
29 changed files with 73 additions and 72 deletions
|
|
@ -20,7 +20,6 @@
|
||||||
|
|
||||||
static char *binddn = NULL;
|
static char *binddn = NULL;
|
||||||
static char *passwd = NULL;
|
static char *passwd = NULL;
|
||||||
static char *base = NULL;
|
|
||||||
static char *ldaphost = NULL;
|
static char *ldaphost = NULL;
|
||||||
static int ldapport = 0;
|
static int ldapport = 0;
|
||||||
static int not, verbose, contoper;
|
static int not, verbose, contoper;
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@
|
||||||
|
|
||||||
static char *binddn = NULL;
|
static char *binddn = NULL;
|
||||||
static char *passwd = NULL;
|
static char *passwd = NULL;
|
||||||
static char *base = NULL;
|
|
||||||
static char *ldaphost = NULL;
|
static char *ldaphost = NULL;
|
||||||
static int ldapport = 0;
|
static int ldapport = 0;
|
||||||
static int not, verbose, contoper;
|
static int not, verbose, contoper;
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ Salt;
|
||||||
|
|
||||||
typedef struct hash_t
|
typedef struct hash_t
|
||||||
{
|
{
|
||||||
char *name;
|
const char *name;
|
||||||
unsigned int namesz;
|
unsigned int namesz;
|
||||||
char *(*func) (const char *, Salt *);
|
char *(*func) (const char *, Salt *);
|
||||||
unsigned char takes_salt;
|
unsigned char takes_salt;
|
||||||
|
|
@ -89,7 +89,7 @@ static int auto_gen_pw = 0;
|
||||||
* pw_encode() essentially base64 encodes a password and its salt
|
* pw_encode() essentially base64 encodes a password and its salt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char *
|
static char *
|
||||||
pw_encode (unsigned char *passwd, Salt * salt, unsigned int len)
|
pw_encode (unsigned char *passwd, Salt * salt, unsigned int len)
|
||||||
{
|
{
|
||||||
int salted = salt && salt->salt && salt->len;
|
int salted = salt && salt->salt && salt->len;
|
||||||
|
|
@ -123,7 +123,7 @@ pw_encode (unsigned char *passwd, Salt * salt, unsigned int len)
|
||||||
* if you'd like to write a better salt generator, please, be my guest.
|
* if you'd like to write a better salt generator, please, be my guest.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
static void
|
||||||
make_salt (Salt * salt, unsigned int len)
|
make_salt (Salt * salt, unsigned int len)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -141,7 +141,7 @@ make_salt (Salt * salt, unsigned int len)
|
||||||
* password generator
|
* password generator
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char *
|
static char *
|
||||||
gen_pass (unsigned int len)
|
gen_pass (unsigned int len)
|
||||||
{
|
{
|
||||||
static const unsigned char autogen[] =
|
static const unsigned char autogen[] =
|
||||||
|
|
@ -160,7 +160,7 @@ gen_pass (unsigned int len)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLAPD_CLEARTEXT
|
#ifdef SLAPD_CLEARTEXT
|
||||||
char *
|
static char *
|
||||||
hash_none (const char *pw_in, Salt * salt)
|
hash_none (const char *pw_in, Salt * salt)
|
||||||
{
|
{
|
||||||
return (strdup (pw_in));
|
return (strdup (pw_in));
|
||||||
|
|
@ -168,7 +168,7 @@ hash_none (const char *pw_in, Salt * salt)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SLAPD_CRYPT
|
#ifdef SLAPD_CRYPT
|
||||||
char *
|
static char *
|
||||||
hash_crypt (const char *pw_in, Salt * salt)
|
hash_crypt (const char *pw_in, Salt * salt)
|
||||||
{
|
{
|
||||||
static const unsigned char crypt64[] =
|
static const unsigned char crypt64[] =
|
||||||
|
|
@ -198,7 +198,7 @@ hash_crypt (const char *pw_in, Salt * salt)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *
|
static char *
|
||||||
hash_md5 (const char *pw_in, Salt * salt)
|
hash_md5 (const char *pw_in, Salt * salt)
|
||||||
{
|
{
|
||||||
lutil_MD5_CTX MD5context;
|
lutil_MD5_CTX MD5context;
|
||||||
|
|
@ -214,7 +214,7 @@ hash_md5 (const char *pw_in, Salt * salt)
|
||||||
return (pw_encode (MD5digest, salt, sizeof (MD5digest)));
|
return (pw_encode (MD5digest, salt, sizeof (MD5digest)));
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
static char *
|
||||||
hash_sha1 (const char *pw_in, Salt * salt)
|
hash_sha1 (const char *pw_in, Salt * salt)
|
||||||
{
|
{
|
||||||
lutil_SHA1_CTX SHA1context;
|
lutil_SHA1_CTX SHA1context;
|
||||||
|
|
@ -230,7 +230,7 @@ hash_sha1 (const char *pw_in, Salt * salt)
|
||||||
return (pw_encode (SHA1digest, salt, sizeof (SHA1digest)));
|
return (pw_encode (SHA1digest, salt, sizeof (SHA1digest)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Hash hashes[] =
|
static const Hash hashes[] =
|
||||||
{
|
{
|
||||||
#ifdef SLAPD_CLEARTEXT
|
#ifdef SLAPD_CLEARTEXT
|
||||||
{"none", 4, hash_none, 0, HASHTYPE_NONE, HASHTYPE_NONE, 0},
|
{"none", 4, hash_none, 0, HASHTYPE_NONE, HASHTYPE_NONE, 0},
|
||||||
|
|
@ -245,7 +245,7 @@ static Hash hashes[] =
|
||||||
{NULL, 0, NULL, 0, HASHTYPE_NONE, HASHTYPE_NONE, 0}
|
{NULL, 0, NULL, 0, HASHTYPE_NONE, HASHTYPE_NONE, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
int
|
static int
|
||||||
modify_dn (LDAP * ld, char *targetdn, char *pwattr, char *oldpw,
|
modify_dn (LDAP * ld, char *targetdn, char *pwattr, char *oldpw,
|
||||||
char *newpw, HashTypes htype, Salt * salt)
|
char *newpw, HashTypes htype, Salt * salt)
|
||||||
{
|
{
|
||||||
|
|
@ -325,8 +325,8 @@ modify_dn (LDAP * ld, char *targetdn, char *pwattr, char *oldpw,
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
usage (char *s)
|
usage(const char *s)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "Usage: %s [options] [filter]\n", s);
|
fprintf (stderr, "Usage: %s [options] [filter]\n", s);
|
||||||
fprintf (stderr, " -a attrib\tpassword attribute (default: " LDAP_PASSWD_ATTRIB ")\n");
|
fprintf (stderr, " -a attrib\tpassword attribute (default: " LDAP_PASSWD_ATTRIB ")\n");
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#define DEFSEP "="
|
#define DEFSEP "="
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage( char *s )
|
usage( const char *s )
|
||||||
{
|
{
|
||||||
fprintf( stderr,
|
fprintf( stderr,
|
||||||
"usage: %s [options] filter [attributes...]\nwhere:\n"
|
"usage: %s [options] filter [attributes...]\nwhere:\n"
|
||||||
|
|
@ -561,7 +561,8 @@ static int dosearch(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void print_entry(
|
static void
|
||||||
|
print_entry(
|
||||||
LDAP *ld,
|
LDAP *ld,
|
||||||
LDAPMessage *entry,
|
LDAPMessage *entry,
|
||||||
int attrsonly)
|
int attrsonly)
|
||||||
|
|
@ -679,7 +680,7 @@ void print_entry(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
static int
|
||||||
write_ldif( int type, char *name, char *value, ber_len_t vallen )
|
write_ldif( int type, char *name, char *value, ber_len_t vallen )
|
||||||
{
|
{
|
||||||
char *ldif;
|
char *ldif;
|
||||||
|
|
|
||||||
|
|
@ -1026,8 +1026,8 @@ dgram_read( Sockbuf *sb, void *buf, ber_len_t len )
|
||||||
|
|
||||||
if ( sb->sb_debug ) {
|
if ( sb->sb_debug ) {
|
||||||
ber_log_printf( LDAP_DEBUG_ANY, sb->sb_debug,
|
ber_log_printf( LDAP_DEBUG_ANY, sb->sb_debug,
|
||||||
"dgram_read udp_read %d bytes\n",
|
"dgram_read udp_read %ld bytes\n",
|
||||||
rc );
|
(long) rc );
|
||||||
if ( rc > 0 )
|
if ( rc > 0 )
|
||||||
ber_log_bprint( LDAP_DEBUG_PACKETS, sb->sb_debug,
|
ber_log_bprint( LDAP_DEBUG_PACKETS, sb->sb_debug,
|
||||||
buf, rc );
|
buf, rc );
|
||||||
|
|
|
||||||
|
|
@ -261,8 +261,8 @@ ldap_add_result_to_cache( LDAP *ld, LDAPMessage *result )
|
||||||
LDAPMessage *m, **mp, *req, *new, *prev;
|
LDAPMessage *m, **mp, *req, *new, *prev;
|
||||||
int err, keep;
|
int err, keep;
|
||||||
|
|
||||||
Debug( LDAP_DEBUG_TRACE, "ldap_add_result_to_cache: id %d, type %d\n",
|
Debug( LDAP_DEBUG_TRACE, "ldap_add_result_to_cache: id %ld, type %ld\n",
|
||||||
result->lm_msgid, result->lm_msgtype, 0 );
|
(long) result->lm_msgid, (long) result->lm_msgtype, 0 );
|
||||||
|
|
||||||
if ( ld->ld_cache == NULL ||
|
if ( ld->ld_cache == NULL ||
|
||||||
( ld->ld_cache->lc_enabled == 0 )) {
|
( ld->ld_cache->lc_enabled == 0 )) {
|
||||||
|
|
@ -394,8 +394,8 @@ ldap_check_cache( LDAP *ld, ber_tag_t msgtype, BerElement *request )
|
||||||
prev = NULL;
|
prev = NULL;
|
||||||
hash = cache_hash( &reqber );
|
hash = cache_hash( &reqber );
|
||||||
for ( m = ld->ld_cache->lc_buckets[ hash ]; m != NULL; m = next ) {
|
for ( m = ld->ld_cache->lc_buckets[ hash ]; m != NULL; m = next ) {
|
||||||
Debug( LDAP_DEBUG_TRACE,"cc: examining id %d,type %d\n",
|
Debug( LDAP_DEBUG_TRACE,"cc: examining id %ld,type %ld\n",
|
||||||
m->lm_msgid, m->lm_msgtype, 0 );
|
(long) m->lm_msgid, (long) m->lm_msgtype, 0 );
|
||||||
if ( difftime(c_time, m->lm_time) > ld->ld_cache->lc_timeout ) {
|
if ( difftime(c_time, m->lm_time) > ld->ld_cache->lc_timeout ) {
|
||||||
/* delete expired message */
|
/* delete expired message */
|
||||||
next = m->lm_next;
|
next = m->lm_next;
|
||||||
|
|
@ -441,8 +441,8 @@ ldap_check_cache( LDAP *ld, ber_tag_t msgtype, BerElement *request )
|
||||||
prev->lm_chain = new;
|
prev->lm_chain = new;
|
||||||
}
|
}
|
||||||
prev = new;
|
prev = new;
|
||||||
Debug( LDAP_DEBUG_TRACE, "cc: added type %d\n",
|
Debug( LDAP_DEBUG_TRACE, "cc: added type %ld\n",
|
||||||
new->lm_msgtype, 0, 0 );
|
(long) new->lm_msgtype, 0, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug( LDAP_DEBUG_TRACE, "cc: result returned from cache\n", 0, 0, 0 );
|
Debug( LDAP_DEBUG_TRACE, "cc: result returned from cache\n", 0, 0, 0 );
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ decode_answer( unsigned char *answer, ber_len_t len )
|
||||||
rr_len = _getshort( p );
|
rr_len = _getshort( p );
|
||||||
p += INT16SZ;
|
p += INT16SZ;
|
||||||
if ( class == C_IN && type == T_TXT ) {
|
if ( class == C_IN && type == T_TXT ) {
|
||||||
int i, n, pref, txt_len;
|
int pref, txt_len;
|
||||||
char *q, *r;
|
char *q, *r;
|
||||||
|
|
||||||
q = (char *)p;
|
q = (char *)p;
|
||||||
|
|
|
||||||
|
|
@ -187,8 +187,8 @@ ldap_pvt_connect(LDAP *ld, ber_socket_t s, struct sockaddr_in *sin, int async)
|
||||||
tv.tv_sec = opt_tv->tv_sec;
|
tv.tv_sec = opt_tv->tv_sec;
|
||||||
}
|
}
|
||||||
|
|
||||||
osip_debug(ld, "ldap_connect_timeout: fd: %d tm: %d async: %d\n",
|
osip_debug(ld, "ldap_connect_timeout: fd: %d tm: %ld async: %d\n",
|
||||||
s, opt_tv ? tv.tv_sec : -1, async);
|
s, opt_tv ? tv.tv_sec : -1L, async);
|
||||||
|
|
||||||
if ( ldap_pvt_ndelay_on(ld, s) == -1 )
|
if ( ldap_pvt_ndelay_on(ld, s) == -1 )
|
||||||
return ( -1 );
|
return ( -1 );
|
||||||
|
|
|
||||||
|
|
@ -340,7 +340,7 @@ try_read1msg(
|
||||||
if (( lr = ldap_find_request_by_msgid( ld, id )) == NULL ) {
|
if (( lr = ldap_find_request_by_msgid( ld, id )) == NULL ) {
|
||||||
Debug( LDAP_DEBUG_ANY,
|
Debug( LDAP_DEBUG_ANY,
|
||||||
"no request for response with msgid %ld (tossing)\n",
|
"no request for response with msgid %ld (tossing)\n",
|
||||||
id, 0, 0 );
|
(long) id, 0, 0 );
|
||||||
ber_free( ber, 1 );
|
ber_free( ber, 1 );
|
||||||
return( -2 ); /* continue looking */
|
return( -2 ); /* continue looking */
|
||||||
}
|
}
|
||||||
|
|
@ -352,10 +352,10 @@ try_read1msg(
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug( LDAP_DEBUG_TRACE, "ldap_read: %s msgid %ld, original id %d\n",
|
Debug( LDAP_DEBUG_TRACE, "ldap_read: %s msgid %ld, original id %ld\n",
|
||||||
( tag == LDAP_RES_SEARCH_ENTRY ) ? "entry" :
|
( tag == LDAP_RES_SEARCH_ENTRY ) ? "entry" :
|
||||||
( tag == LDAP_RES_SEARCH_REFERENCE ) ? "reference" : "result",
|
( tag == LDAP_RES_SEARCH_REFERENCE ) ? "reference" : "result",
|
||||||
id, lr->lr_origid );
|
(long) id, (long) lr->lr_origid );
|
||||||
|
|
||||||
id = lr->lr_origid;
|
id = lr->lr_origid;
|
||||||
refer_cnt = 0;
|
refer_cnt = 0;
|
||||||
|
|
@ -428,7 +428,7 @@ Debug( LDAP_DEBUG_TRACE,
|
||||||
id = lr->lr_msgid;
|
id = lr->lr_msgid;
|
||||||
tag = lr->lr_res_msgtype;
|
tag = lr->lr_res_msgtype;
|
||||||
Debug( LDAP_DEBUG_ANY, "request %ld done\n",
|
Debug( LDAP_DEBUG_ANY, "request %ld done\n",
|
||||||
id, 0, 0 );
|
(long) id, 0, 0 );
|
||||||
Debug( LDAP_DEBUG_TRACE,
|
Debug( LDAP_DEBUG_TRACE,
|
||||||
"res_errno: %d, res_error: <%s>, res_matched: <%s>\n",
|
"res_errno: %d, res_error: <%s>, res_matched: <%s>\n",
|
||||||
lr->lr_res_errno, lr->lr_res_error ? lr->lr_res_error : "",
|
lr->lr_res_errno, lr->lr_res_error ? lr->lr_res_error : "",
|
||||||
|
|
@ -510,8 +510,8 @@ lr->lr_res_matched ? lr->lr_res_matched : "" );
|
||||||
return( -2 ); /* continue looking */
|
return( -2 ); /* continue looking */
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug( LDAP_DEBUG_TRACE, "adding response id %d type %d:\n",
|
Debug( LDAP_DEBUG_TRACE, "adding response id %ld type %ld:\n",
|
||||||
new->lm_msgid, new->lm_msgtype, 0 );
|
(long) new->lm_msgid, (long) new->lm_msgtype, 0 );
|
||||||
|
|
||||||
/* part of a search response - add to end of list of entries */
|
/* part of a search response - add to end of list of entries */
|
||||||
for ( tmp = l; tmp->lm_chain != NULL &&
|
for ( tmp = l; tmp->lm_chain != NULL &&
|
||||||
|
|
|
||||||
|
|
@ -1260,9 +1260,6 @@ ldap_str2attributetype( const char * s, int * code, const char ** errp )
|
||||||
int seen_substr = 0;
|
int seen_substr = 0;
|
||||||
int seen_syntax = 0;
|
int seen_syntax = 0;
|
||||||
int seen_usage = 0;
|
int seen_usage = 0;
|
||||||
int seen_kind = 0;
|
|
||||||
int seen_must = 0;
|
|
||||||
int seen_may = 0;
|
|
||||||
LDAP_ATTRIBUTE_TYPE * at;
|
LDAP_ATTRIBUTE_TYPE * at;
|
||||||
char ** ssdummy;
|
char ** ssdummy;
|
||||||
const char * savepos;
|
const char * savepos;
|
||||||
|
|
|
||||||
|
|
@ -517,7 +517,7 @@ acl_check_modlist(
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLAPD_ACI_ENABLED
|
#ifdef SLAPD_ACI_ENABLED
|
||||||
char *
|
static char *
|
||||||
aci_bvstrdup (struct berval *bv)
|
aci_bvstrdup (struct berval *bv)
|
||||||
{
|
{
|
||||||
char *s;
|
char *s;
|
||||||
|
|
@ -530,7 +530,7 @@ aci_bvstrdup (struct berval *bv)
|
||||||
return(s);
|
return(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
aci_strbvcmp (char *s, struct berval *bv)
|
aci_strbvcmp (char *s, struct berval *bv)
|
||||||
{
|
{
|
||||||
int res, len;
|
int res, len;
|
||||||
|
|
@ -546,7 +546,7 @@ aci_strbvcmp (char *s, struct berval *bv)
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
aci_get_part (struct berval *list, int ix, char sep, struct berval *bv)
|
aci_get_part (struct berval *list, int ix, char sep, struct berval *bv)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
|
|
@ -581,7 +581,7 @@ aci_get_part (struct berval *list, int ix, char sep, struct berval *bv)
|
||||||
return(bv->bv_len);
|
return(bv->bv_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
aci_list_has_right (struct berval *list, int access, int action)
|
aci_list_has_right (struct berval *list, int access, int action)
|
||||||
{
|
{
|
||||||
struct berval bv;
|
struct berval bv;
|
||||||
|
|
@ -640,7 +640,7 @@ aci_list_has_right (struct berval *list, int access, int action)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
aci_list_has_attr (struct berval *list, char *attr)
|
aci_list_has_attr (struct berval *list, char *attr)
|
||||||
{
|
{
|
||||||
struct berval bv;
|
struct berval bv;
|
||||||
|
|
@ -654,10 +654,10 @@ aci_list_has_attr (struct berval *list, char *attr)
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
aci_list_has_attr_right (struct berval *list, char *attr, int access, int action)
|
aci_list_has_attr_right (struct berval *list, char *attr, int access, int action)
|
||||||
{
|
{
|
||||||
struct berval bv, entry;
|
struct berval bv;
|
||||||
int i, found;
|
int i, found;
|
||||||
|
|
||||||
/* loop through each rights/attr pair, skip first part (action) */
|
/* loop through each rights/attr pair, skip first part (action) */
|
||||||
|
|
@ -674,7 +674,7 @@ aci_list_has_attr_right (struct berval *list, char *attr, int access, int action
|
||||||
return(found);
|
return(found);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
aci_list_has_permission (struct berval *list, char *attr, int access)
|
aci_list_has_permission (struct berval *list, char *attr, int access)
|
||||||
{
|
{
|
||||||
struct berval perm, actn;
|
struct berval perm, actn;
|
||||||
|
|
@ -707,7 +707,7 @@ aci_list_has_permission (struct berval *list, char *attr, int access)
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
aci_group_member (
|
aci_group_member (
|
||||||
struct berval *subj,
|
struct berval *subj,
|
||||||
char *grpoc,
|
char *grpoc,
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,9 @@ struct ldapinfo {
|
||||||
|
|
||||||
struct ldapconn *ldap_back_getconn(struct ldapinfo *li, struct slap_conn *conn,
|
struct ldapconn *ldap_back_getconn(struct ldapinfo *li, struct slap_conn *conn,
|
||||||
struct slap_op *op);
|
struct slap_op *op);
|
||||||
|
void ldap_back_dobind(struct ldapconn *lc, Operation *op);
|
||||||
|
int ldap_back_op_result(struct ldapconn *lc, Operation *op);
|
||||||
|
int back_ldap_LTX_init_module(int argc, char *argv[]);
|
||||||
|
|
||||||
LDAP_END_DECL
|
LDAP_END_DECL
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,7 @@ ldap_back_getconn(struct ldapinfo *li, Connection *conn, Operation *op)
|
||||||
return( lc );
|
return( lc );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
ldap_back_dobind(struct ldapconn *lc, Operation *op)
|
ldap_back_dobind(struct ldapconn *lc, Operation *op)
|
||||||
{
|
{
|
||||||
if (lc->bound)
|
if (lc->bound)
|
||||||
|
|
@ -103,6 +104,7 @@ ldap_back_dobind(struct ldapconn *lc, Operation *op)
|
||||||
lc->bound = 1;
|
lc->bound = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
ldap_back_op_result(struct ldapconn *lc, Operation *op)
|
ldap_back_op_result(struct ldapconn *lc, Operation *op)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,9 @@
|
||||||
#include "slap.h"
|
#include "slap.h"
|
||||||
#include "back-ldap.h"
|
#include "back-ldap.h"
|
||||||
|
|
||||||
|
static void ldap_send_entry( Backend *be, Operation *op, struct ldapconn *lc,
|
||||||
|
LDAPMessage *e, char **attrs, int attrsonly );
|
||||||
|
|
||||||
int
|
int
|
||||||
ldap_back_search(
|
ldap_back_search(
|
||||||
Backend *be,
|
Backend *be,
|
||||||
|
|
@ -125,6 +128,7 @@ fail: return( ldap_back_op_result(lc, op) );
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
ldap_send_entry(
|
ldap_send_entry(
|
||||||
Backend *be,
|
Backend *be,
|
||||||
Operation *op,
|
Operation *op,
|
||||||
|
|
|
||||||
|
|
@ -278,7 +278,6 @@ dn2entry_rw(
|
||||||
int rw
|
int rw
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
|
|
||||||
ID id;
|
ID id;
|
||||||
Entry *e = NULL;
|
Entry *e = NULL;
|
||||||
char *pdn;
|
char *pdn;
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@
|
||||||
static ID
|
static ID
|
||||||
next_id_read( Backend *be )
|
next_id_read( Backend *be )
|
||||||
{
|
{
|
||||||
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
|
|
||||||
ID id = NOID;
|
ID id = NOID;
|
||||||
Datum key, data;
|
Datum key, data;
|
||||||
DBCache *db;
|
DBCache *db;
|
||||||
|
|
|
||||||
|
|
@ -353,7 +353,6 @@ search_candidates(
|
||||||
int manageDSAit
|
int manageDSAit
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
|
|
||||||
ID_BLOCK *candidates;
|
ID_BLOCK *candidates;
|
||||||
Filter *f, *rf, *af, *lf;
|
Filter *f, *rf, *af, *lf;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ shell_back_add(
|
||||||
|
|
||||||
/* write out the request to the add process */
|
/* write out the request to the add process */
|
||||||
fprintf( wfp, "ADD\n" );
|
fprintf( wfp, "ADD\n" );
|
||||||
fprintf( wfp, "msgid: %ld\n", op->o_msgid );
|
fprintf( wfp, "msgid: %ld\n", (long) op->o_msgid );
|
||||||
print_suffixes( wfp, be );
|
print_suffixes( wfp, be );
|
||||||
ldap_pvt_thread_mutex_lock( &entry2str_mutex );
|
ldap_pvt_thread_mutex_lock( &entry2str_mutex );
|
||||||
fprintf( wfp, "%s", entry2str( e, &len ) );
|
fprintf( wfp, "%s", entry2str( e, &len ) );
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ shell_back_bind(
|
||||||
|
|
||||||
/* write out the request to the bind process */
|
/* write out the request to the bind process */
|
||||||
fprintf( wfp, "BIND\n" );
|
fprintf( wfp, "BIND\n" );
|
||||||
fprintf( wfp, "msgid: %ld\n", op->o_msgid );
|
fprintf( wfp, "msgid: %ld\n", (long) op->o_msgid );
|
||||||
print_suffixes( wfp, be );
|
print_suffixes( wfp, be );
|
||||||
fprintf( wfp, "dn: %s\n", dn );
|
fprintf( wfp, "dn: %s\n", dn );
|
||||||
fprintf( wfp, "method: %d\n", method );
|
fprintf( wfp, "method: %d\n", method );
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ shell_back_compare(
|
||||||
|
|
||||||
/* write out the request to the compare process */
|
/* write out the request to the compare process */
|
||||||
fprintf( wfp, "COMPARE\n" );
|
fprintf( wfp, "COMPARE\n" );
|
||||||
fprintf( wfp, "msgid: %ld\n", op->o_msgid );
|
fprintf( wfp, "msgid: %ld\n", (long) op->o_msgid );
|
||||||
print_suffixes( wfp, be );
|
print_suffixes( wfp, be );
|
||||||
fprintf( wfp, "dn: %s\n", dn );
|
fprintf( wfp, "dn: %s\n", dn );
|
||||||
fprintf( wfp, "%s: %s\n", ava->ava_type, ava->ava_value.bv_val );
|
fprintf( wfp, "%s: %s\n", ava->ava_type, ava->ava_value.bv_val );
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ shell_back_delete(
|
||||||
|
|
||||||
/* write out the request to the delete process */
|
/* write out the request to the delete process */
|
||||||
fprintf( wfp, "DELETE\n" );
|
fprintf( wfp, "DELETE\n" );
|
||||||
fprintf( wfp, "msgid: %ld\n", op->o_msgid );
|
fprintf( wfp, "msgid: %ld\n", (long) op->o_msgid );
|
||||||
print_suffixes( wfp, be );
|
print_suffixes( wfp, be );
|
||||||
fprintf( wfp, "dn: %s\n", dn );
|
fprintf( wfp, "dn: %s\n", dn );
|
||||||
fclose( wfp );
|
fclose( wfp );
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ shell_back_modify(
|
||||||
|
|
||||||
/* write out the request to the modify process */
|
/* write out the request to the modify process */
|
||||||
fprintf( wfp, "MODIFY\n" );
|
fprintf( wfp, "MODIFY\n" );
|
||||||
fprintf( wfp, "msgid: %ld\n", op->o_msgid );
|
fprintf( wfp, "msgid: %ld\n", (long) op->o_msgid );
|
||||||
print_suffixes( wfp, be );
|
print_suffixes( wfp, be );
|
||||||
fprintf( wfp, "dn: %s\n", dn );
|
fprintf( wfp, "dn: %s\n", dn );
|
||||||
for ( ; ml != NULL; ml = ml->ml_next ) {
|
for ( ; ml != NULL; ml = ml->ml_next ) {
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ shell_back_modrdn(
|
||||||
|
|
||||||
/* write out the request to the modrdn process */
|
/* write out the request to the modrdn process */
|
||||||
fprintf( wfp, "MODRDN\n" );
|
fprintf( wfp, "MODRDN\n" );
|
||||||
fprintf( wfp, "msgid: %ld\n", op->o_msgid );
|
fprintf( wfp, "msgid: %ld\n", (long) op->o_msgid );
|
||||||
print_suffixes( wfp, be );
|
print_suffixes( wfp, be );
|
||||||
fprintf( wfp, "dn: %s\n", dn );
|
fprintf( wfp, "dn: %s\n", dn );
|
||||||
fprintf( wfp, "newrdn: %s\n", newrdn );
|
fprintf( wfp, "newrdn: %s\n", newrdn );
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,7 @@ shell_back_search(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
struct shellinfo *si = (struct shellinfo *) be->be_private;
|
struct shellinfo *si = (struct shellinfo *) be->be_private;
|
||||||
int i, rc, bsize, len;
|
int i;
|
||||||
int err;
|
|
||||||
char *matched, *info;
|
|
||||||
FILE *rfp, *wfp;
|
FILE *rfp, *wfp;
|
||||||
|
|
||||||
if ( si->si_search == NULL ) {
|
if ( si->si_search == NULL ) {
|
||||||
|
|
@ -47,7 +45,7 @@ shell_back_search(
|
||||||
|
|
||||||
/* write out the request to the search process */
|
/* write out the request to the search process */
|
||||||
fprintf( wfp, "SEARCH\n" );
|
fprintf( wfp, "SEARCH\n" );
|
||||||
fprintf( wfp, "msgid: %ld\n", op->o_msgid );
|
fprintf( wfp, "msgid: %ld\n", (long) op->o_msgid );
|
||||||
print_suffixes( wfp, be );
|
print_suffixes( wfp, be );
|
||||||
fprintf( wfp, "base: %s\n", base );
|
fprintf( wfp, "base: %s\n", base );
|
||||||
fprintf( wfp, "scope: %d\n", scope );
|
fprintf( wfp, "scope: %d\n", scope );
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ shell_back_unbind(
|
||||||
|
|
||||||
/* write out the request to the unbind process */
|
/* write out the request to the unbind process */
|
||||||
fprintf( wfp, "UNBIND\n" );
|
fprintf( wfp, "UNBIND\n" );
|
||||||
fprintf( wfp, "msgid: %ld\n", op->o_msgid );
|
fprintf( wfp, "msgid: %ld\n", (long) op->o_msgid );
|
||||||
print_suffixes( wfp, be );
|
print_suffixes( wfp, be );
|
||||||
fprintf( wfp, "dn: %s\n", (conn->c_dn ? conn->c_dn : "") );
|
fprintf( wfp, "dn: %s\n", (conn->c_dn ? conn->c_dn : "") );
|
||||||
fclose( wfp );
|
fclose( wfp );
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,6 @@ static
|
||||||
volatile sig_atomic_t slapd_shutdown = 0;
|
volatile sig_atomic_t slapd_shutdown = 0;
|
||||||
|
|
||||||
static ldap_pvt_thread_t listener_tid;
|
static ldap_pvt_thread_t listener_tid;
|
||||||
static volatile sig_atomic_t slapd_listener = 0;
|
|
||||||
|
|
||||||
static struct slap_daemon {
|
static struct slap_daemon {
|
||||||
ldap_pvt_thread_mutex_t sd_mutex;
|
ldap_pvt_thread_mutex_t sd_mutex;
|
||||||
|
|
@ -170,7 +169,7 @@ static void slapd_close(ber_socket_t s) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Listener *
|
static Listener *
|
||||||
open_listener(
|
open_listener(
|
||||||
const char* url,
|
const char* url,
|
||||||
int port,
|
int port,
|
||||||
|
|
@ -447,7 +446,7 @@ slapd_daemon_task(
|
||||||
int err = sock_errno();
|
int err = sock_errno();
|
||||||
Debug( LDAP_DEBUG_ANY,
|
Debug( LDAP_DEBUG_ANY,
|
||||||
"daemon: listen(%s, 5) failed errno=%d (%s)\n",
|
"daemon: listen(%s, 5) failed errno=%d (%s)\n",
|
||||||
(long) slap_listeners[l]->sl_url, err,
|
slap_listeners[l]->sl_url, err,
|
||||||
sock_errstr(err) );
|
sock_errstr(err) );
|
||||||
return( (void*)-1 );
|
return( (void*)-1 );
|
||||||
}
|
}
|
||||||
|
|
@ -742,7 +741,7 @@ slapd_daemon_task(
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
for ( i = 0; i < nfds; i++ ) {
|
for ( i = 0; i < nfds; i++ ) {
|
||||||
int a, r, w;
|
int r, w;
|
||||||
int is_listener = 0;
|
int is_listener = 0;
|
||||||
|
|
||||||
for ( l = 0; slap_listeners[l] != NULL; l++ ) {
|
for ( l = 0; slap_listeners[l] != NULL; l++ ) {
|
||||||
|
|
|
||||||
|
|
@ -368,6 +368,9 @@ Syntax *syn_find_desc LDAP_P((const char *syndesc, int *slen));
|
||||||
int syn_add LDAP_P((LDAP_SYNTAX *syn, slap_syntax_check_func *check, const char **err));
|
int syn_add LDAP_P((LDAP_SYNTAX *syn, slap_syntax_check_func *check, const char **err));
|
||||||
MatchingRule *mr_find LDAP_P((const char *mrname));
|
MatchingRule *mr_find LDAP_P((const char *mrname));
|
||||||
int mr_add LDAP_P((LDAP_MATCHING_RULE *mr, slap_mr_normalize_func *normalize, slap_mr_compare_func *compare, const char **err));
|
int mr_add LDAP_P((LDAP_MATCHING_RULE *mr, slap_mr_normalize_func *normalize, slap_mr_compare_func *compare, const char **err));
|
||||||
|
int case_ignore_normalize LDAP_P((struct berval *val, struct berval **normalized));
|
||||||
|
int register_syntax LDAP_P((char *desc, slap_syntax_check_func *check ));
|
||||||
|
int register_matching_rule LDAP_P((char * desc, slap_mr_normalize_func *normalize, slap_mr_compare_func *compare));
|
||||||
void schema_info LDAP_P((Connection *conn, Operation *op, char **attrs, int attrsonly));
|
void schema_info LDAP_P((Connection *conn, Operation *op, char **attrs, int attrsonly));
|
||||||
int schema_init LDAP_P((void));
|
int schema_init LDAP_P((void));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -556,8 +556,10 @@ diff_centroids(
|
||||||
int nentries
|
int nentries
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
#ifdef LDBM_ORDERED
|
||||||
Datum okey, nkey;
|
Datum okey, nkey;
|
||||||
Datum olast, nlast;
|
Datum olast, nlast;
|
||||||
|
#endif
|
||||||
Datum lastkey, key;
|
Datum lastkey, key;
|
||||||
Datum data;
|
Datum data;
|
||||||
LDAPMod **mods;
|
LDAPMod **mods;
|
||||||
|
|
@ -573,10 +575,6 @@ diff_centroids(
|
||||||
fflush( stdout );
|
fflush( stdout );
|
||||||
}
|
}
|
||||||
|
|
||||||
ldbm_datum_init( okey );
|
|
||||||
ldbm_datum_init( nkey );
|
|
||||||
ldbm_datum_init( olast );
|
|
||||||
ldbm_datum_init( nlast );
|
|
||||||
ldbm_datum_init( lastkey );
|
ldbm_datum_init( lastkey );
|
||||||
ldbm_datum_init( key );
|
ldbm_datum_init( key );
|
||||||
ldbm_datum_init( data );
|
ldbm_datum_init( data );
|
||||||
|
|
@ -618,6 +616,11 @@ diff_centroids(
|
||||||
* dual traversal, yielding O(N) performance.
|
* dual traversal, yielding O(N) performance.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
ldbm_datum_init( okey );
|
||||||
|
ldbm_datum_init( nkey );
|
||||||
|
ldbm_datum_init( olast );
|
||||||
|
ldbm_datum_init( nlast );
|
||||||
|
|
||||||
olast.dptr = NULL;
|
olast.dptr = NULL;
|
||||||
nlast.dptr = NULL;
|
nlast.dptr = NULL;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,12 +89,8 @@ main( int argc, char **argv )
|
||||||
scount = 0; ssize = 0;
|
scount = 0; ssize = 0;
|
||||||
if ( (bvals = ldap_get_values_len( ld, e, attrs[i] )) != NULL ) {
|
if ( (bvals = ldap_get_values_len( ld, e, attrs[i] )) != NULL ) {
|
||||||
for ( j = 0; bvals[j] != NULL; j++ ) {
|
for ( j = 0; bvals[j] != NULL; j++ ) {
|
||||||
Datum key, data;
|
|
||||||
char *w;
|
char *w;
|
||||||
|
|
||||||
ldbm_datum_init( key );
|
|
||||||
ldbm_datum_init( data );
|
|
||||||
|
|
||||||
/* update value count */
|
/* update value count */
|
||||||
vcount++;
|
vcount++;
|
||||||
vsize += bvals[j]->bv_len;
|
vsize += bvals[j]->bv_len;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue