static char *binddn = NULL;
static char *passwd = NULL;
-static char *base = NULL;
static char *ldaphost = NULL;
static int ldapport = 0;
static int not, verbose, contoper;
static char *binddn = NULL;
static char *passwd = NULL;
-static char *base = NULL;
static char *ldaphost = NULL;
static int ldapport = 0;
static int not, verbose, contoper;
typedef struct hash_t
{
- char *name;
+ const char *name;
unsigned int namesz;
char *(*func) (const char *, Salt *);
unsigned char takes_salt;
* pw_encode() essentially base64 encodes a password and its salt
*/
-char *
+static char *
pw_encode (unsigned char *passwd, Salt * salt, unsigned int len)
{
int salted = salt && salt->salt && salt->len;
* if you'd like to write a better salt generator, please, be my guest.
*/
-void
+static void
make_salt (Salt * salt, unsigned int len)
{
* password generator
*/
-char *
+static char *
gen_pass (unsigned int len)
{
static const unsigned char autogen[] =
}
#ifdef SLAPD_CLEARTEXT
-char *
+static char *
hash_none (const char *pw_in, Salt * salt)
{
return (strdup (pw_in));
#endif
#ifdef SLAPD_CRYPT
-char *
+static char *
hash_crypt (const char *pw_in, Salt * salt)
{
static const unsigned char crypt64[] =
}
#endif
-char *
+static char *
hash_md5 (const char *pw_in, Salt * salt)
{
lutil_MD5_CTX MD5context;
return (pw_encode (MD5digest, salt, sizeof (MD5digest)));
}
-char *
+static char *
hash_sha1 (const char *pw_in, Salt * salt)
{
lutil_SHA1_CTX SHA1context;
return (pw_encode (SHA1digest, salt, sizeof (SHA1digest)));
}
-static Hash hashes[] =
+static const Hash hashes[] =
{
#ifdef SLAPD_CLEARTEXT
{"none", 4, hash_none, 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,
char *newpw, HashTypes htype, Salt * salt)
{
return (ret);
}
-void
-usage (char *s)
+static void
+usage(const char *s)
{
fprintf (stderr, "Usage: %s [options] [filter]\n", s);
fprintf (stderr, " -a attrib\tpassword attribute (default: " LDAP_PASSWD_ATTRIB ")\n");
#define DEFSEP "="
static void
-usage( char *s )
+usage( const char *s )
{
fprintf( stderr,
"usage: %s [options] filter [attributes...]\nwhere:\n"
}
-void print_entry(
+static void
+print_entry(
LDAP *ld,
LDAPMessage *entry,
int attrsonly)
}
-int
+static int
write_ldif( int type, char *name, char *value, ber_len_t vallen )
{
char *ldif;
if ( sb->sb_debug ) {
ber_log_printf( LDAP_DEBUG_ANY, sb->sb_debug,
- "dgram_read udp_read %d bytes\n",
- rc );
+ "dgram_read udp_read %ld bytes\n",
+ (long) rc );
if ( rc > 0 )
ber_log_bprint( LDAP_DEBUG_PACKETS, sb->sb_debug,
buf, rc );
LDAPMessage *m, **mp, *req, *new, *prev;
int err, keep;
- Debug( LDAP_DEBUG_TRACE, "ldap_add_result_to_cache: id %d, type %d\n",
- result->lm_msgid, result->lm_msgtype, 0 );
+ Debug( LDAP_DEBUG_TRACE, "ldap_add_result_to_cache: id %ld, type %ld\n",
+ (long) result->lm_msgid, (long) result->lm_msgtype, 0 );
if ( ld->ld_cache == NULL ||
( ld->ld_cache->lc_enabled == 0 )) {
prev = NULL;
hash = cache_hash( &reqber );
for ( m = ld->ld_cache->lc_buckets[ hash ]; m != NULL; m = next ) {
- Debug( LDAP_DEBUG_TRACE,"cc: examining id %d,type %d\n",
- m->lm_msgid, m->lm_msgtype, 0 );
+ Debug( LDAP_DEBUG_TRACE,"cc: examining id %ld,type %ld\n",
+ (long) m->lm_msgid, (long) m->lm_msgtype, 0 );
if ( difftime(c_time, m->lm_time) > ld->ld_cache->lc_timeout ) {
/* delete expired message */
next = m->lm_next;
prev->lm_chain = new;
}
prev = new;
- Debug( LDAP_DEBUG_TRACE, "cc: added type %d\n",
- new->lm_msgtype, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "cc: added type %ld\n",
+ (long) new->lm_msgtype, 0, 0 );
}
Debug( LDAP_DEBUG_TRACE, "cc: result returned from cache\n", 0, 0, 0 );
rr_len = _getshort( p );
p += INT16SZ;
if ( class == C_IN && type == T_TXT ) {
- int i, n, pref, txt_len;
+ int pref, txt_len;
char *q, *r;
q = (char *)p;
tv.tv_sec = opt_tv->tv_sec;
}
- osip_debug(ld, "ldap_connect_timeout: fd: %d tm: %d async: %d\n",
- s, opt_tv ? tv.tv_sec : -1, async);
+ osip_debug(ld, "ldap_connect_timeout: fd: %d tm: %ld async: %d\n",
+ s, opt_tv ? tv.tv_sec : -1L, async);
if ( ldap_pvt_ndelay_on(ld, s) == -1 )
return ( -1 );
if (( lr = ldap_find_request_by_msgid( ld, id )) == NULL ) {
Debug( LDAP_DEBUG_ANY,
"no request for response with msgid %ld (tossing)\n",
- id, 0, 0 );
+ (long) id, 0, 0 );
ber_free( ber, 1 );
return( -2 ); /* continue looking */
}
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_REFERENCE ) ? "reference" : "result",
- id, lr->lr_origid );
+ (long) id, (long) lr->lr_origid );
id = lr->lr_origid;
refer_cnt = 0;
id = lr->lr_msgid;
tag = lr->lr_res_msgtype;
Debug( LDAP_DEBUG_ANY, "request %ld done\n",
- id, 0, 0 );
+ (long) id, 0, 0 );
Debug( LDAP_DEBUG_TRACE,
"res_errno: %d, res_error: <%s>, res_matched: <%s>\n",
lr->lr_res_errno, lr->lr_res_error ? lr->lr_res_error : "",
return( -2 ); /* continue looking */
}
- Debug( LDAP_DEBUG_TRACE, "adding response id %d type %d:\n",
- new->lm_msgid, new->lm_msgtype, 0 );
+ Debug( LDAP_DEBUG_TRACE, "adding response id %ld type %ld:\n",
+ (long) new->lm_msgid, (long) new->lm_msgtype, 0 );
/* part of a search response - add to end of list of entries */
for ( tmp = l; tmp->lm_chain != NULL &&
int seen_substr = 0;
int seen_syntax = 0;
int seen_usage = 0;
- int seen_kind = 0;
- int seen_must = 0;
- int seen_may = 0;
LDAP_ATTRIBUTE_TYPE * at;
char ** ssdummy;
const char * savepos;
}
#ifdef SLAPD_ACI_ENABLED
-char *
+static char *
aci_bvstrdup (struct berval *bv)
{
char *s;
return(s);
}
-int
+static int
aci_strbvcmp (char *s, struct berval *bv)
{
int res, len;
return(0);
}
-int
+static int
aci_get_part (struct berval *list, int ix, char sep, struct berval *bv)
{
int len;
return(bv->bv_len);
}
-int
+static int
aci_list_has_right (struct berval *list, int access, int action)
{
struct berval bv;
#endif
}
-int
+static int
aci_list_has_attr (struct berval *list, char *attr)
{
struct berval bv;
return(0);
}
-int
+static int
aci_list_has_attr_right (struct berval *list, char *attr, int access, int action)
{
- struct berval bv, entry;
+ struct berval bv;
int i, found;
/* loop through each rights/attr pair, skip first part (action) */
return(found);
}
-int
+static int
aci_list_has_permission (struct berval *list, char *attr, int access)
{
struct berval perm, actn;
return(0);
}
-int
+static int
aci_group_member (
struct berval *subj,
char *grpoc,
struct ldapconn *ldap_back_getconn(struct ldapinfo *li, struct slap_conn *conn,
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
return( lc );
}
+void
ldap_back_dobind(struct ldapconn *lc, Operation *op)
{
if (lc->bound)
lc->bound = 1;
}
+int
ldap_back_op_result(struct ldapconn *lc, Operation *op)
{
int err;
#include "slap.h"
#include "back-ldap.h"
+static void ldap_send_entry( Backend *be, Operation *op, struct ldapconn *lc,
+ LDAPMessage *e, char **attrs, int attrsonly );
+
int
ldap_back_search(
Backend *be,
return( 0 );
}
+static void
ldap_send_entry(
Backend *be,
Operation *op,
int rw
)
{
- struct ldbminfo *li = (struct ldbminfo *) be->be_private;
ID id;
Entry *e = NULL;
char *pdn;
static ID
next_id_read( Backend *be )
{
- struct ldbminfo *li = (struct ldbminfo *) be->be_private;
ID id = NOID;
Datum key, data;
DBCache *db;
int manageDSAit
)
{
- struct ldbminfo *li = (struct ldbminfo *) be->be_private;
ID_BLOCK *candidates;
Filter *f, *rf, *af, *lf;
/* write out the request to the add process */
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 );
ldap_pvt_thread_mutex_lock( &entry2str_mutex );
fprintf( wfp, "%s", entry2str( e, &len ) );
/* write out the request to the bind process */
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 );
fprintf( wfp, "dn: %s\n", dn );
fprintf( wfp, "method: %d\n", method );
/* write out the request to the compare process */
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 );
fprintf( wfp, "dn: %s\n", dn );
fprintf( wfp, "%s: %s\n", ava->ava_type, ava->ava_value.bv_val );
/* write out the request to the delete process */
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 );
fprintf( wfp, "dn: %s\n", dn );
fclose( wfp );
/* write out the request to the modify process */
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 );
fprintf( wfp, "dn: %s\n", dn );
for ( ; ml != NULL; ml = ml->ml_next ) {
/* write out the request to the modrdn process */
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 );
fprintf( wfp, "dn: %s\n", dn );
fprintf( wfp, "newrdn: %s\n", newrdn );
)
{
struct shellinfo *si = (struct shellinfo *) be->be_private;
- int i, rc, bsize, len;
- int err;
- char *matched, *info;
+ int i;
FILE *rfp, *wfp;
if ( si->si_search == NULL ) {
/* write out the request to the search process */
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 );
fprintf( wfp, "base: %s\n", base );
fprintf( wfp, "scope: %d\n", scope );
/* write out the request to the unbind process */
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 );
fprintf( wfp, "dn: %s\n", (conn->c_dn ? conn->c_dn : "") );
fclose( wfp );
volatile sig_atomic_t slapd_shutdown = 0;
static ldap_pvt_thread_t listener_tid;
-static volatile sig_atomic_t slapd_listener = 0;
static struct slap_daemon {
ldap_pvt_thread_mutex_t sd_mutex;
}
-Listener *
+static Listener *
open_listener(
const char* url,
int port,
int err = sock_errno();
Debug( LDAP_DEBUG_ANY,
"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) );
return( (void*)-1 );
}
}
#else
for ( i = 0; i < nfds; i++ ) {
- int a, r, w;
+ int r, w;
int is_listener = 0;
for ( l = 0; slap_listeners[l] != NULL; l++ ) {
int syn_add LDAP_P((LDAP_SYNTAX *syn, slap_syntax_check_func *check, const char **err));
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 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));
int schema_init LDAP_P((void));
int nentries
)
{
+#ifdef LDBM_ORDERED
Datum okey, nkey;
Datum olast, nlast;
+#endif
Datum lastkey, key;
Datum data;
LDAPMod **mods;
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( key );
ldbm_datum_init( data );
* 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;
nlast.dptr = NULL;
scount = 0; ssize = 0;
if ( (bvals = ldap_get_values_len( ld, e, attrs[i] )) != NULL ) {
for ( j = 0; bvals[j] != NULL; j++ ) {
- Datum key, data;
char *w;
- ldbm_datum_init( key );
- ldbm_datum_init( data );
-
/* update value count */
vcount++;
vsize += bvals[j]->bv_len;