本文整理汇总了C++中BER_BVISEMPTY函数的典型用法代码示例。如果您正苦于以下问题:C++ BER_BVISEMPTY函数的具体用法?C++ BER_BVISEMPTY怎么用?C++ BER_BVISEMPTY使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BER_BVISEMPTY函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pguid_db_init
static int
pguid_db_init(
BackendDB *be,
ConfigReply *cr)
{
if ( SLAP_ISGLOBALOVERLAY( be ) ) {
Log0( LDAP_DEBUG_ANY, LDAP_LEVEL_ERR,
"pguid_db_init: pguid cannot be used as global overlay.\n" );
return 1;
}
if ( be->be_nsuffix == NULL ) {
Log0( LDAP_DEBUG_ANY, LDAP_LEVEL_ERR,
"pguid_db_init: database must have suffix\n" );
return 1;
}
if ( BER_BVISNULL( &be->be_rootndn ) || BER_BVISEMPTY( &be->be_rootndn ) ) {
Log1( LDAP_DEBUG_ANY, LDAP_LEVEL_ERR,
"pguid_db_init: missing rootdn for database DN=\"%s\", YMMV\n",
be->be_suffix[ 0 ].bv_val );
}
return 0;
}
示例2: slapi_modify_internal_pb
int
slapi_modify_internal_pb( Slapi_PBlock *pb )
{
SlapReply *rs;
if ( pb == NULL ) {
return -1;
}
PBLOCK_ASSERT_INTOP( pb, LDAP_REQ_MODIFY );
rs = pb->pb_rs;
if ( pb->pb_op->orm_modlist == NULL ) {
rs->sr_err = LDAP_PARAM_ERROR;
goto cleanup;
}
if ( BER_BVISEMPTY( &pb->pb_op->o_req_ndn ) ) {
rs->sr_err = LDAP_UNWILLING_TO_PERFORM;
goto cleanup;
}
rs->sr_err = slap_mods_check( pb->pb_op, pb->pb_op->orm_modlist,
&rs->sr_text, pb->pb_textbuf, sizeof( pb->pb_textbuf ), NULL );
if ( rs->sr_err != LDAP_SUCCESS ) {
goto cleanup;
}
slapi_int_func_internal_pb( pb, op_modify );
cleanup:
return 0;
}
示例3: rwm_mapping_dst_free
void
rwm_mapping_dst_free( void *v_mapping )
{
struct ldapmapping *mapping = v_mapping;
if ( BER_BVISEMPTY( &mapping[0].m_dst ) ) {
rwm_mapping_free( &mapping[ -1 ] );
}
}
示例4: mapping_dst_free
static void
mapping_dst_free(
void *v_mapping )
{
struct ldapmapping *mapping = v_mapping;
if ( BER_BVISEMPTY( &mapping->dst ) ) {
mapping_free( &mapping[ -1 ] );
}
}
示例5: fe_op_bind_success
int
fe_op_bind_success( Operation *op, SlapReply *rs )
{
ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
if( op->o_conn->c_authz_backend == NULL ) {
op->o_conn->c_authz_backend = op->o_bd;
}
/* be_bind returns regular/global edn */
if( !BER_BVISEMPTY( &op->orb_edn ) ) {
op->o_conn->c_dn = op->orb_edn;
} else {
ber_dupbv(&op->o_conn->c_dn, &op->o_req_dn);
}
ber_dupbv( &op->o_conn->c_ndn, &op->o_req_ndn );
/* op->o_conn->c_sb may be 0 for internal operations */
if( !BER_BVISEMPTY( &op->o_conn->c_dn ) && op->o_conn->c_sb != 0 ) {
ber_len_t max = sockbuf_max_incoming_auth;
ber_sockbuf_ctrl( op->o_conn->c_sb,
LBER_SB_OPT_SET_MAX_INCOMING, &max );
}
/* log authorization identity */
Statslog( LDAP_DEBUG_STATS,
"%s BIND dn=\"%s\" mech=%s ssf=0\n",
op->o_log_prefix,
op->o_conn->c_dn.bv_val, op->orb_mech.bv_val );
Debug( LDAP_DEBUG_TRACE,
"do_bind: v%d bind: \"%s\" to \"%s\"\n",
op->o_protocol, op->o_req_dn.bv_val, op->o_conn->c_dn.bv_val );
ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
/* send this here to avoid a race condition */
send_ldap_result( op, rs );
return LDAP_SUCCESS;
}
示例6: slapi_search_internal_callback_pb
int
slapi_search_internal_callback_pb( Slapi_PBlock *pb,
void *callback_data,
plugin_result_callback prc,
plugin_search_entry_callback psec,
plugin_referral_entry_callback prec )
{
int free_filter = 0;
SlapReply *rs;
if ( pb == NULL ) {
return -1;
}
PBLOCK_ASSERT_INTOP( pb, LDAP_REQ_SEARCH );
rs = pb->pb_rs;
/* search callback and arguments */
slapi_pblock_set( pb, SLAPI_X_INTOP_RESULT_CALLBACK, (void *)prc );
slapi_pblock_set( pb, SLAPI_X_INTOP_SEARCH_ENTRY_CALLBACK, (void *)psec );
slapi_pblock_set( pb, SLAPI_X_INTOP_REFERRAL_ENTRY_CALLBACK, (void *)prec );
slapi_pblock_set( pb, SLAPI_X_INTOP_CALLBACK_DATA, (void *)callback_data );
if ( BER_BVISEMPTY( &pb->pb_op->ors_filterstr )) {
rs->sr_err = LDAP_PARAM_ERROR;
goto cleanup;
}
if ( pb->pb_op->ors_filter == NULL ) {
pb->pb_op->ors_filter = slapi_str2filter( pb->pb_op->ors_filterstr.bv_val );
if ( pb->pb_op->ors_filter == NULL ) {
rs->sr_err = LDAP_PROTOCOL_ERROR;
goto cleanup;
}
free_filter = 1;
}
slapi_int_func_internal_pb( pb, op_search );
cleanup:
if ( free_filter ) {
slapi_filter_free( pb->pb_op->ors_filter, 1 );
pb->pb_op->ors_filter = NULL;
}
slapi_pblock_delete_param( pb, SLAPI_X_INTOP_RESULT_CALLBACK );
slapi_pblock_delete_param( pb, SLAPI_X_INTOP_SEARCH_ENTRY_CALLBACK );
slapi_pblock_delete_param( pb, SLAPI_X_INTOP_REFERRAL_ENTRY_CALLBACK );
slapi_pblock_delete_param( pb, SLAPI_X_INTOP_CALLBACK_DATA );
return 0;
}
示例7: pam_uid2dn
static int pam_uid2dn(nssov_info *ni, Operation *op,
struct paminfo *pi)
{
struct berval sdn;
BER_BVZERO(&pi->dn);
if (!isvalidusername(&pi->uid)) {
Debug(LDAP_DEBUG_ANY,"nssov_pam_uid2dn(%s): invalid user name\n",
pi->uid.bv_val,0,0);
return NSLCD_PAM_USER_UNKNOWN;
}
if (ni->ni_pam_opts & NI_PAM_SASL2DN) {
int hlen = global_host_bv.bv_len;
/* cn=<service>+uid=<user>,cn=<host>,cn=pam,cn=auth */
sdn.bv_len = pi->uid.bv_len + pi->svc.bv_len + hlen +
STRLENOF( "cn=+uid=,cn=,cn=pam,cn=auth" );
sdn.bv_val = op->o_tmpalloc( sdn.bv_len + 1, op->o_tmpmemctx );
sprintf(sdn.bv_val, "cn=%s+uid=%s,cn=%s,cn=pam,cn=auth",
pi->svc.bv_val, pi->uid.bv_val, global_host_bv.bv_val);
slap_sasl2dn(op, &sdn, &pi->dn, 0);
op->o_tmpfree( sdn.bv_val, op->o_tmpmemctx );
}
/* If no luck, do a basic uid search */
if (BER_BVISEMPTY(&pi->dn) && (ni->ni_pam_opts & NI_PAM_UID2DN)) {
nssov_uid2dn(op, ni, &pi->uid, &pi->dn);
if (!BER_BVISEMPTY(&pi->dn)) {
sdn = pi->dn;
dnNormalize( 0, NULL, NULL, &sdn, &pi->dn, op->o_tmpmemctx );
}
}
if (BER_BVISEMPTY(&pi->dn)) {
return NSLCD_PAM_USER_UNKNOWN;
}
return 0;
}
示例8: sss_parseCtrl
/* Conforms to RFC4510 re: Criticality, original RFC2891 spec is broken
* Also see ITS#7253 for discussion
*/
static int sss_parseCtrl(
Operation *op,
SlapReply *rs,
LDAPControl *ctrl )
{
BerElementBuffer berbuf;
BerElement *ber;
ber_tag_t tag;
ber_len_t len;
int i;
sort_ctrl *sc;
rs->sr_err = LDAP_PROTOCOL_ERROR;
if ( op->o_ctrlflag[sss_cid] > SLAP_CONTROL_IGNORED ) {
rs->sr_text = "sorted results control specified multiple times";
} else if ( BER_BVISNULL( &ctrl->ldctl_value ) ) {
rs->sr_text = "sorted results control value is absent";
} else if ( BER_BVISEMPTY( &ctrl->ldctl_value ) ) {
rs->sr_text = "sorted results control value is empty";
} else {
rs->sr_err = LDAP_SUCCESS;
}
if ( rs->sr_err != LDAP_SUCCESS )
return rs->sr_err;
op->o_ctrlflag[sss_cid] = ctrl->ldctl_iscritical ?
SLAP_CONTROL_CRITICAL : SLAP_CONTROL_NONCRITICAL;
ber = (BerElement *)&berbuf;
ber_init2( ber, &ctrl->ldctl_value, 0 );
i = count_key( ber );
sc = op->o_tmpalloc( sizeof(sort_ctrl) +
(i-1) * sizeof(sort_key), op->o_tmpmemctx );
sc->sc_nkeys = i;
op->o_controls[sss_cid] = sc;
/* peel off initial sequence */
ber_scanf( ber, "{" );
i = 0;
do {
if ( build_key( ber, rs, &sc->sc_keys[i] ) != LDAP_SUCCESS )
break;
i++;
tag = ber_peek_tag( ber, &len );
} while ( tag != LBER_DEFAULT );
return rs->sr_err;
}
示例9: ndb_tool_dn2id_get
ID ndb_tool_dn2id_get(
Backend *be,
struct berval *dn
)
{
struct ndb_info *ni = (struct ndb_info *) be->be_private;
NdbArgs NA;
NdbRdns rdns;
Entry e;
char text[1024];
Operation op = {0};
Opheader ohdr = {0};
int rc;
if ( BER_BVISEMPTY(dn) )
return 0;
NA.ndb = myNdb;
NA.txn = myNdb->startTransaction();
if ( !NA.txn ) {
snprintf( text, sizeof(text),
"startTransaction failed: %s (%d)",
myNdb->getNdbError().message, myNdb->getNdbError().code );
Debug( LDAP_DEBUG_ANY,
"=> " LDAP_XSTRING(ndb_tool_dn2id_get) ": %s\n",
text, 0, 0 );
return NOID;
}
if ( myOcList ) {
ber_bvarray_free( myOcList );
myOcList = NULL;
}
op.o_hdr = &ohdr;
op.o_bd = be;
op.o_tmpmemctx = NULL;
op.o_tmpmfuncs = &ch_mfuncs;
NA.e = &e;
e.e_name = *dn;
NA.rdns = &rdns;
NA.ocs = NULL;
rc = ndb_entry_get_info( &op, &NA, 0, NULL );
myOcList = NA.ocs;
NA.txn->close();
if ( rc )
return NOID;
myDn = *dn;
return e.e_id;
}
示例10: unload_extop
int
unload_extop(
const struct berval *ext_oid,
SLAP_EXTOP_MAIN_FN *ext_main,
unsigned flags )
{
struct berval oidm = BER_BVNULL;
struct extop_list *ext, **extp;
/* oid must be given */
if ( ext_oid == NULL || BER_BVISNULL( ext_oid ) ||
BER_BVISEMPTY( ext_oid ) )
{
return -1;
}
/* if it's not an oid, check if it's a macto */
if ( numericoidValidate( NULL, (struct berval *)ext_oid ) !=
LDAP_SUCCESS )
{
oidm.bv_val = oidm_find( ext_oid->bv_val );
if ( oidm.bv_val == NULL ) {
return -1;
}
oidm.bv_len = strlen( oidm.bv_val );
ext_oid = &oidm;
}
/* lookup the oid */
for ( extp = &supp_ext_list; *extp; extp = &(*extp)->next ) {
if ( bvmatch( ext_oid, &(*extp)->oid ) ) {
/* if ext_main is given, only remove if it matches */
if ( ext_main != NULL && (*extp)->ext_main != ext_main ) {
return -1;
}
break;
}
}
if ( *extp == NULL ) {
return -1;
}
ext = *extp;
*extp = (*extp)->next;
ch_free( ext );
return 0;
}
示例11: slapi_op_bind_callback
static int
slapi_op_bind_callback( Operation *op, SlapReply *rs, int prc )
{
switch ( prc ) {
case SLAPI_BIND_SUCCESS:
/* Continue with backend processing */
break;
case SLAPI_BIND_FAIL:
/* Failure, frontend (that's us) sends result */
rs->sr_err = LDAP_INVALID_CREDENTIALS;
send_ldap_result( op, rs );
return rs->sr_err;
break;
case SLAPI_BIND_ANONYMOUS: /* undocumented */
default: /* plugin sent result or no plugins called */
BER_BVZERO( &op->orb_edn );
if ( rs->sr_err == LDAP_SUCCESS ) {
/*
* Plugin will have called slapi_pblock_set(LDAP_CONN_DN) which
* will have set conn->c_dn and conn->c_ndn
*/
if ( BER_BVISNULL( &op->o_conn->c_ndn ) && prc == 1 ) {
/* No plugins were called; continue processing */
return LDAP_SUCCESS;
}
ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
if ( !BER_BVISEMPTY( &op->o_conn->c_ndn ) ) {
ber_len_t max = sockbuf_max_incoming_auth;
ber_sockbuf_ctrl( op->o_conn->c_sb,
LBER_SB_OPT_SET_MAX_INCOMING, &max );
}
ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
/* log authorization identity */
Statslog( LDAP_DEBUG_STATS,
"%s BIND dn=\"%s\" mech=%s (SLAPI) ssf=0\n",
op->o_log_prefix,
BER_BVISNULL( &op->o_conn->c_dn )
? "<empty>" : op->o_conn->c_dn.bv_val,
BER_BVISNULL( &op->orb_mech )
? "<empty>" : op->orb_mech.bv_val, 0, 0 );
return -1;
}
break;
}
return rs->sr_err;
}
示例12: rdnval_is_valid
static int
rdnval_is_valid( AttributeDescription *desc, struct berval *value )
{
if ( desc->ad_type->sat_syntax == slap_schema.si_syn_directoryString ) {
return 1;
}
if ( desc->ad_type->sat_syntax == syn_IA5String
&& !BER_BVISEMPTY( value ) )
{
return 1;
}
return 0;
}
示例13: aci_list_get_rights
static int
aci_list_get_rights(
struct berval *list,
struct berval *attr,
struct berval *val,
slap_access_t *grant,
slap_access_t *deny )
{
struct berval perm, actn, baseattr;
slap_access_t *mask;
int i, found;
if ( attr == NULL || BER_BVISEMPTY( attr ) ) {
attr = (struct berval *)&aci_bv[ ACI_BV_ENTRY ];
} else if ( acl_get_part( attr, 0, ';', &baseattr ) > 0 ) {
attr = &baseattr;
}
found = 0;
ACL_INIT(*grant);
ACL_INIT(*deny);
/* loop through each permissions clause */
for ( i = 0; acl_get_part( list, i, '$', &perm ) >= 0; i++ ) {
if ( acl_get_part( &perm, 0, ';', &actn ) < 0 ) {
continue;
}
if ( ber_bvstrcasecmp( &aci_bv[ ACI_BV_GRANT ], &actn ) == 0 ) {
mask = grant;
} else if ( ber_bvstrcasecmp( &aci_bv[ ACI_BV_DENY ], &actn ) == 0 ) {
mask = deny;
} else {
continue;
}
*mask |= aci_list_get_attr_rights( &perm, attr, val );
*mask |= aci_list_get_attr_rights( &perm, &aci_bv[ ACI_BV_BR_ALL ], NULL );
if ( *mask != ACL_PRIV_NONE ) {
found = 1;
}
}
return found;
}
示例14: dnssrv_back_bind
int
dnssrv_back_bind(
Operation *op,
SlapReply *rs )
{
Debug( LDAP_DEBUG_TRACE, "DNSSRV: bind dn=\"%s\" (%d)\n",
BER_BVISNULL( &op->o_req_dn ) ? "" : op->o_req_dn.bv_val,
op->orb_method, 0 );
/* allow rootdn as a means to auth without the need to actually
* contact the proxied DSA */
switch ( be_rootdn_bind( op, NULL ) ) {
case LDAP_SUCCESS:
/* frontend will send result */
return rs->sr_err;
default:
/* treat failure and like any other bind, otherwise
* it could reveal the DN of the rootdn */
break;
}
if ( !BER_BVISNULL( &op->orb_cred ) &&
!BER_BVISEMPTY( &op->orb_cred ) )
{
/* simple bind */
Statslog( LDAP_DEBUG_STATS,
"%s DNSSRV BIND dn=\"%s\" provided cleartext passwd\n",
op->o_log_prefix,
BER_BVISNULL( &op->o_req_dn ) ? "" : op->o_req_dn.bv_val , 0, 0, 0 );
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
"you shouldn't send strangers your password" );
} else {
/* unauthenticated bind */
/* NOTE: we're not going to get here anyway:
* unauthenticated bind is dealt with by the frontend */
Debug( LDAP_DEBUG_TRACE, "DNSSRV: BIND dn=\"%s\"\n",
BER_BVISNULL( &op->o_req_dn ) ? "" : op->o_req_dn.bv_val, 0, 0 );
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
"anonymous bind expected" );
}
return 1;
}
示例15: bv_getcaseidx
/*
* Matches given berval to array of bervals
* Returns:
* >=0 if one if the array elements equals to this berval
* -1 if string was not found in array
*/
static int
bv_getcaseidx(
struct berval *bv,
const struct berval *arr[] )
{
int i;
if ( BER_BVISEMPTY( bv ) ) {
return -1;
}
for ( i = 0; arr[ i ] != NULL ; i++ ) {
if ( ber_bvstrcasecmp( bv, arr[ i ] ) == 0 ) {
return i;
}
}
return -1;
}