本文整理汇总了C++中slapi_ch_strdup函数的典型用法代码示例。如果您正苦于以下问题:C++ slapi_ch_strdup函数的具体用法?C++ slapi_ch_strdup怎么用?C++ slapi_ch_strdup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了slapi_ch_strdup函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: slapi_lookup_instance_name_by_suffix
/*
* lookup instance names by suffix.
* if isexact == 0: returns instances including ones that associates with
* its sub suffixes.
* e.g., suffix: "o=<suffix>" is given, these are returned:
* suffixes: o=<suffix>, ou=<ou>,o=<suffix>, ...
* instances: inst of "o=<suffix>",
* inst of "ou=<ou>,o=<suffix>",
* ...
* if isexact != 0: returns an instance that associates with the given suffix
* e.g., suffix: "o=<suffix>" is given, these are returned:
* suffixes: "o=<suffix>"
* instances: inst of "o=<suffix>"
* Note: if suffixes
*/
int
slapi_lookup_instance_name_by_suffix(char *suffix,
char ***suffixes, char ***instances, int isexact)
{
Slapi_Backend *be = NULL;
struct suffixlist *list;
char *cookie = NULL;
const char *thisdn;
int thisdnlen;
int suffixlen;
int count;
int i;
int rval = -1;
if (instances == NULL)
return rval;
PR_ASSERT(suffix);
rval = 0;
suffixlen = strlen(suffix);
cookie = NULL;
be = slapi_get_first_backend (&cookie);
while (be) {
if (NULL == be->be_suffixlist) {
be = (backend *)slapi_get_next_backend (cookie);
continue;
}
count = slapi_counter_get_value(be->be_suffixcounter);
list = be->be_suffixlist;
for (i = 0; list && i < count; i++) {
thisdn = slapi_sdn_get_ndn(list->be_suffix);
thisdnlen = slapi_sdn_get_ndn_len(list->be_suffix);
if (isexact?suffixlen!=thisdnlen:suffixlen>thisdnlen){
list = list->next;
continue;
}
if (isexact?(!slapi_UTF8CASECMP(suffix, (char *)thisdn)):
(!slapi_UTF8CASECMP(suffix, (char *)thisdn+thisdnlen-suffixlen)))
{
charray_add(instances, slapi_ch_strdup(be->be_name));
if (suffixes)
charray_add(suffixes, slapi_ch_strdup(thisdn));
}
list = list->next;
}
be = (backend *)slapi_get_next_backend (cookie);
}
slapi_ch_free((void **)&cookie);
return rval;
}
开发者ID:Firstyear,项目名称:ds,代码行数:67,代码来源:backend_manager.c
示例2: ipa_topo_connection_fanout_new
struct node_fanout *
ipa_topo_connection_fanout_new (char *from, char *to)
{
struct node_fanout *new_fanout = (struct node_fanout *)
slapi_ch_malloc(sizeof(struct node_fanout));
struct node_list *targets = (struct node_list *)
slapi_ch_malloc(sizeof(struct node_list));
targets->next = NULL;
targets->node = slapi_ch_strdup(to);
new_fanout->next = NULL;
new_fanout->node = slapi_ch_strdup(from);
new_fanout->targets = targets;
new_fanout->visited = 0;
return new_fanout;
}
开发者ID:LiptonB,项目名称:freeipa,代码行数:15,代码来源:topology_pre.c
示例3: has_attr
/*
Checks whether an entry has a particular attribute type, and optionally
returns the value. Only for use with single-valued attributes - it returns
the first value it finds.
*/
int
has_attr( Slapi_Entry* target_entry, char* attr_name, char** val ) {
Slapi_ValueSet *values = NULL;
Slapi_Value* sval;
char *actual_type_name = NULL;
int type_name_disposition = 0, attr_free_flags = 0, rc = 0;
/* Use vattr interface to support virtual attributes, e.g.
acctPolicySubentry has a good chance of being supplied by CoS */
if ( slapi_vattr_values_get( target_entry, attr_name, &values, &type_name_disposition, &actual_type_name, 0, &attr_free_flags) == 0) {
if( slapi_valueset_first_value( values, &sval ) == -1 ) {
rc = 0;
} else {
rc = 1;
if( val ) {
/* Caller wants a copy of the found attribute's value */
*val = slapi_ch_strdup( slapi_value_get_string( sval ) );
}
}
} else {
rc = 0;
}
slapi_vattr_values_free(&values, &actual_type_name, attr_free_flags);
return( rc );
}
开发者ID:Firstyear,项目名称:ds,代码行数:31,代码来源:acct_util.c
示例4: slapi_over_config
int slapi_over_config( BackendDB *be, ConfigReply *cr )
{
if ( slapi_over_initialized == 0 ) {
int rc;
/* do global initializaiton */
ldap_pvt_thread_mutex_init( &slapi_hn_mutex );
ldap_pvt_thread_mutex_init( &slapi_time_mutex );
ldap_pvt_thread_mutex_init( &slapi_printmessage_mutex );
if ( slapi_log_file == NULL )
slapi_log_file = slapi_ch_strdup( LDAP_RUNDIR LDAP_DIRSEP "errors" );
rc = slapi_int_init_object_extensions();
if ( rc != 0 )
return rc;
rc = slapi_over_init();
if ( rc != 0 )
return rc;
slapi_over_initialized = 1;
}
return overlay_config( be, SLAPI_OVERLAY_NAME, -1, NULL, cr );
}
开发者ID:MPlatform,项目名称:mdb,代码行数:26,代码来源:slapi_overlay.c
示例5: GetDomainUsername
int
GetDomainUsername(
char *pszNTuserdomainid,
char *pszNTDomain,
char *pszNTUsername
)
{
char *pszAttr, *pDomain, *pUsername;
if( !pszNTuserdomainid )
return( 1 );
// Split the specially constructed attribute.
pszAttr = slapi_ch_strdup( pszNTuserdomainid );
pDomain = pszAttr;
pUsername = strchr( pszAttr, ':' );
if( pUsername == NULL )
return( 1 );
// Set the end of the NT Domain name,
// and the start of the NT username.
*pUsername = (char)NULL;
pUsername++;
strcpy( pszNTDomain, pDomain);
strcpy( pszNTUsername, pUsername);
slapi_ch_free( (void**)&pszAttr );
return( 0 );
}
开发者ID:leto,项目名称:389-ds,代码行数:33,代码来源:ldbm_bind.c
示例6: get_rdn_plus_uniqueid
static char *
get_rdn_plus_uniqueid(char *sessionid, const char *olddn, const char *uniqueid)
{
char *newrdn;
/* Check if the RDN already contains the Unique ID */
Slapi_DN *sdn= slapi_sdn_new_dn_byval(olddn);
Slapi_RDN *rdn= slapi_rdn_new();
slapi_sdn_get_rdn(sdn,rdn);
PR_ASSERT(uniqueid!=NULL);
if(slapi_rdn_contains(rdn,SLAPI_ATTR_UNIQUEID,uniqueid,strlen(uniqueid)))
{
/* The Unique ID is already in the RDN.
* This is a highly improbable collision.
* It suggests that a duplicate UUID was generated.
* This will cause replication divergence and will
* require admin intercession
*/
slapi_log_error(SLAPI_LOG_FATAL, sessionid,
"Annotated DN %s has naming conflict\n", olddn );
newrdn= NULL;
}
else
{
slapi_rdn_add(rdn,SLAPI_ATTR_UNIQUEID,uniqueid);
newrdn= slapi_ch_strdup(slapi_rdn_get_rdn(rdn));
}
slapi_sdn_free(&sdn);
slapi_rdn_free(&rdn);
return newrdn;
}
开发者ID:ohamada,项目名称:389ds,代码行数:30,代码来源:urp.c
示例7: or_indexer_create
static int
or_indexer_create (Slapi_PBlock* pb)
{
auto int rc = LDAP_UNAVAILABLE_CRITICAL_EXTENSION; /* failed to initialize */
auto char* mrOID = NULL;
auto void* mrOBJECT = NULL;
if (slapi_pblock_get (pb, SLAPI_PLUGIN_MR_OID, &mrOID) || mrOID == NULL) {
slapi_log_err(SLAPI_LOG_FILTER, COLLATE_PLUGIN_SUBSYSTEM,
"or_indexer_create - No OID parameter\n");
} else {
auto indexer_t* ix = indexer_create (mrOID);
auto char* mrTYPE = NULL;
slapi_pblock_get (pb, SLAPI_PLUGIN_MR_TYPE, &mrTYPE);
slapi_log_err(SLAPI_LOG_FILTER, "or_indexer_create", "(oid %s; type %s)\n",
mrOID, mrTYPE ? mrTYPE : "<NULL>");
if (ix != NULL) {
if (ix->ix_index != NULL &&
!slapi_pblock_set (pb, SLAPI_PLUGIN_OBJECT, ix) &&
!slapi_pblock_set (pb, SLAPI_PLUGIN_MR_OID, ix->ix_oid) &&
!slapi_pblock_set (pb, SLAPI_PLUGIN_MR_INDEX_FN, (void*)op_index_entry) &&
!slapi_pblock_set (pb, SLAPI_PLUGIN_DESTROY_FN, (void*)op_indexer_destroy)) {
mrOBJECT = ix;
rc = 0; /* success */
} else {
indexer_free (ix);
}
} else { /* mrOID does not identify an ordering rule. */
/* Is it an ordering rule OID with the substring suffix? */
auto size_t oidlen = strlen (mrOID);
if (oidlen > 2 && mrOID[oidlen-2] == '.' &&
atoi (mrOID + oidlen - 1) == SLAPI_OP_SUBSTRING) {
auto char* or_oid = slapi_ch_strdup (mrOID);
or_oid [oidlen-2] = '\0';
ix = indexer_create (or_oid);
if (ix != NULL) {
auto ss_indexer_t* ss = (ss_indexer_t*) slapi_ch_malloc (sizeof (ss_indexer_t));
ss->ss_indexer = ix;
oidlen = strlen (ix->ix_oid);
ss->ss_oid = slapi_ch_malloc (oidlen + 3);
memcpy (ss->ss_oid, ix->ix_oid, oidlen);
sprintf (ss->ss_oid + oidlen, ".%1i", SLAPI_OP_SUBSTRING);
if (ix->ix_index != NULL &&
!slapi_pblock_set (pb, SLAPI_PLUGIN_OBJECT, ss) &&
!slapi_pblock_set (pb, SLAPI_PLUGIN_MR_OID, ss->ss_oid) &&
!slapi_pblock_set (pb, SLAPI_PLUGIN_MR_INDEX_FN, (void*)ss_index_entry) &&
!slapi_pblock_set (pb, SLAPI_PLUGIN_DESTROY_FN, (void*)ss_indexer_destroy)) {
mrOBJECT = ss;
rc = 0; /* success */
} else {
ss_indexer_free (ss);
}
}
slapi_ch_free((void**)&or_oid);
}
}
}
slapi_log_err(SLAPI_LOG_FILTER, COLLATE_PLUGIN_SUBSYSTEM,
"or_indexer_create - (%p) %i\n", mrOBJECT, rc);
return rc;
}
开发者ID:Firstyear,项目名称:ds,代码行数:60,代码来源:orfilter.c
示例8: ipa_topo_connection_fanout_extend
struct node_fanout *
ipa_topo_connection_fanout_extend (struct node_fanout *fanout_in, char *from, char *to)
{
struct node_fanout *cursor;
if (fanout_in == NULL) {
/* init fanout */
return ipa_topo_connection_fanout_new(from,to);
}
/* extend existing fanout struct */
cursor = fanout_in;
while (cursor) {
if (strcasecmp(cursor->node, from) == 0) break;
cursor = cursor->next;
}
if (cursor) {
struct node_list *target = (struct node_list *)
slapi_ch_malloc(sizeof(struct node_list));
target->next = cursor->targets;
target->node = slapi_ch_strdup(to);
cursor->targets = target;
return fanout_in;
} else {
cursor = ipa_topo_connection_fanout_new(from,to);
cursor->next = fanout_in;
return cursor;
}
}
开发者ID:LiptonB,项目名称:freeipa,代码行数:27,代码来源:topology_pre.c
示例9: task_sampletask_add
/*
* Invoked when the task instance is added by the client (step 5 of the comment)
* Get the necessary attributes from the task entry, and spawns a thread to do
* the task.
*/
static int
task_sampletask_add(Slapi_PBlock *pb, Slapi_Entry *e,
Slapi_Entry *eAfter, int *returncode, char *returntext,
void *arg)
{
PRThread *thread = NULL;
const char *cn;
int rv = SLAPI_DSE_CALLBACK_OK;
Slapi_PBlock *mypb = NULL;
Slapi_Task *task = NULL;
const char *myarg;
*returncode = LDAP_SUCCESS;
if ((cn = fetch_attr(e, "cn", NULL)) == NULL) {
*returncode = LDAP_OBJECT_CLASS_VIOLATION;
rv = SLAPI_DSE_CALLBACK_ERROR;
goto out;
}
/* get arg(s) */
if ((myarg = fetch_attr(e, "myarg", NULL)) == NULL) {
*returncode = LDAP_OBJECT_CLASS_VIOLATION;
rv = SLAPI_DSE_CALLBACK_ERROR;
goto out;
}
/* allocate new task now */
task = slapi_new_task(slapi_entry_get_ndn(e));
if (task == NULL) {
slapi_log_err(SLAPI_LOG_ERR, "sampletask", "unable to allocate new task!\n");
*returncode = LDAP_OPERATIONS_ERROR;
rv = SLAPI_DSE_CALLBACK_ERROR;
goto out;
}
/* set a destructor that will clean up myarg for us when the task is complete */
slapi_task_set_destructor_fn(task, task_sampletask_destructor);
/* Stash our argument in the task for use by the task thread */
slapi_task_set_data(task, slapi_ch_strdup(myarg));
/* start the sample task as a separate thread */
thread = PR_CreateThread(PR_USER_THREAD, task_sampletask_thread,
(void *)task, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD,
PR_UNJOINABLE_THREAD, SLAPD_DEFAULT_THREAD_STACKSIZE);
if (thread == NULL) {
slapi_log_err(SLAPI_LOG_ERR, "sampletask",
"unable to create sample task thread!\n");
*returncode = LDAP_OPERATIONS_ERROR;
rv = SLAPI_DSE_CALLBACK_ERROR;
slapi_task_finish(task, *returncode);
} else {
/* thread successful */
rv = SLAPI_DSE_CALLBACK_OK;
}
out:
return rv;
}
开发者ID:Firstyear,项目名称:ds,代码行数:64,代码来源:sampletask.c
示例10: slapi_register_supported_feature
int
slapi_register_supported_feature( char *featureoid )
{
slapi_rwlock_wrlock(supported_features_lock);
charray_add( &supported_features, slapi_ch_strdup( featureoid ));
slapi_rwlock_unlock(supported_features_lock);
return LDAP_SUCCESS;
}
开发者ID:Firstyear,项目名称:ds,代码行数:8,代码来源:features.c
示例11: ldbm_instance_config_instance_dir_set
static int
ldbm_instance_config_instance_dir_set(void *arg, void *value, char *errorbuf, int phase, int apply)
{
ldbm_instance *inst = (ldbm_instance *)arg;
if (!apply) {
return LDAP_SUCCESS;
}
if ((value == NULL) || (strlen(value) == 0))
{
inst->inst_dir_name = NULL;
inst->inst_parent_dir_name = NULL;
}
else
{
char *dir = (char *)value;
if (is_fullpath(dir))
{
char sep = get_sep(dir);
char *p = strrchr(dir, sep);
if (NULL == p) /* should not happens, tho */
{
inst->inst_parent_dir_name = NULL;
inst->inst_dir_name = rel2abspath(dir); /* normalize dir;
strdup'ed in
rel2abspath */
}
else
{
*p = '\0';
inst->inst_parent_dir_name = rel2abspath(dir); /* normalize dir;
strdup'ed in
rel2abspath */
inst->inst_dir_name = slapi_ch_strdup(p+1);
*p = sep;
}
}
else
{
inst->inst_parent_dir_name = NULL;
inst->inst_dir_name = slapi_ch_strdup(dir);
}
}
return LDAP_SUCCESS;
}
开发者ID:ohamada,项目名称:389ds,代码行数:46,代码来源:ldbm_instance_config.c
示例12: new_bitwise_match_cb
/*
The type and val pointers are assumed to have sufficient lifetime -
we don't have to copy them - they are usually just pointers into
the SLAPI_PLUGIN_MR_TYPE and SLAPI_PLUGIN_MR_VALUE fields of the
operation pblock, whose lifetime should encompass the creation
and destruction of the bitwise_match_cb object.
*/
static struct bitwise_match_cb *
new_bitwise_match_cb(char *type, struct berval *val)
{
struct bitwise_match_cb *bmc = (struct bitwise_match_cb *)slapi_ch_calloc(1, sizeof(struct bitwise_match_cb));
bmc->type = slapi_ch_strdup(type);
bmc->val = val;
return bmc;
}
开发者ID:leto,项目名称:389-ds,代码行数:16,代码来源:bitwise.c
示例13: subentry_create_filter
/* Function which wraps a filter with (AND !(objectclass=ldapsubentry)) */
void subentry_create_filter(Slapi_Filter** filter)
{
Slapi_Filter *sub_filter = NULL;
Slapi_Filter *new_filter = NULL;
char *buf = slapi_ch_strdup("(!(objectclass=ldapsubentry))");
sub_filter = slapi_str2filter( buf );
new_filter = slapi_filter_join( LDAP_FILTER_AND, *filter, sub_filter );
*filter = new_filter;
slapi_ch_free((void **)&buf);
}
开发者ID:leto,项目名称:389-ds,代码行数:11,代码来源:subentry.c
示例14: sasl_map_str_concat
static char *
sasl_map_str_concat(char *s1, char *s2)
{
if (NULL == s2) {
return (slapi_ch_strdup(s1));
} else {
char *newstr = slapi_ch_smprintf("%[email protected]%s",s1,s2);
return newstr;
}
}
开发者ID:Firstyear,项目名称:ds,代码行数:10,代码来源:sasl_map.c
示例15: snmp_collator_start
int snmp_collator_start()
{
int err;
char *statspath = config_get_rundir();
char *instdir = config_get_configdir();
char *instname = NULL;
/*
* Get directory for our stats file
*/
if (NULL == statspath) {
statspath = slapi_ch_strdup("/tmp");
}
instname = PL_strrstr(instdir, "slapd-");
if (!instname) {
instname = PL_strrstr(instdir, "/");
if (instname) {
instname++;
}
}
PR_snprintf(szStatsFile, sizeof(szStatsFile), "%s/%s%s",
statspath, instname, AGT_STATS_EXTENSION);
PR_snprintf(stats_sem_name, sizeof(stats_sem_name), "/%s%s",
instname, AGT_STATS_EXTENSION);
tmpstatsfile = szStatsFile;
slapi_ch_free_string(&statspath);
slapi_ch_free_string(&instdir);
/* open the memory map */
if ((err = agt_mopen_stats(tmpstatsfile, O_RDWR, &hdl) != 0))
{
if (err != EEXIST) /* Ignore if file already exists */
{
slapi_log_error(SLAPI_LOG_FATAL, "snmp collator", "Failed to open stats file (%s) "
"(error %d): %s.\n", szStatsFile, err, slapd_system_strerror(err));
exit(1);
}
}
/* Create semaphore for stats file access */
snmp_collator_create_semaphore();
/* point stats struct at mmap data */
stats = (struct agt_stats_t *) mmap_tbl [hdl].fp;
/* initialize stats data */
snmp_collator_init();
/* Arrange to be called back periodically to update the mmap'd stats file. */
snmp_eq_ctx = slapi_eq_repeat(snmp_collator_update, NULL, (time_t)0,
SLAPD_SNMP_UPDATE_INTERVAL);
return 0;
}
开发者ID:leto,项目名称:389-ds,代码行数:55,代码来源:snmp_collator.c
示例16: pam_conv_func
/*
* This is the conversation function passed into pam_start(). This is what sets the password
* that PAM uses to authenticate. This function is sort of stupid - it assumes all echo off
* or binary prompts are for the password, and other prompts are for the username. Time will
* tell if this is actually the case.
*/
static int
pam_conv_func(int num_msg, const struct pam_message **msg, struct pam_response **resp, void *mydata)
{
int ii;
struct berval *creds;
struct my_pam_conv_str *my_data = (struct my_pam_conv_str *)mydata;
struct pam_response *reply;
int ret = PAM_SUCCESS;
if (num_msg <= 0) {
return PAM_CONV_ERR;
}
/* empty reply structure */
reply = (struct pam_response *)slapi_ch_calloc(num_msg,
sizeof(struct pam_response));
slapi_pblock_get( my_data->pb, SLAPI_BIND_CREDENTIALS, &creds ); /* the password */
for (ii = 0; ii < num_msg; ++ii) {
slapi_log_error(SLAPI_LOG_PLUGIN, PAM_PASSTHRU_PLUGIN_SUBSYSTEM,
"pam msg [%d] = %d %s\n", ii, msg[ii]->msg_style,
msg[ii]->msg);
/* hard to tell what prompt is for . . . */
/* assume prompts for password are either BINARY or ECHO_OFF */
if (msg[ii]->msg_style == PAM_PROMPT_ECHO_OFF) {
reply[ii].resp = strdupbv(creds);
#ifdef LINUX
} else if (msg[ii]->msg_style == PAM_BINARY_PROMPT) {
reply[ii].resp = strdupbv(creds);
#endif
} else if (msg[ii]->msg_style == PAM_PROMPT_ECHO_ON) { /* assume username */
reply[ii].resp = slapi_ch_strdup(my_data->pam_identity);
} else if (msg[ii]->msg_style == PAM_ERROR_MSG) {
slapi_log_error(SLAPI_LOG_FATAL, PAM_PASSTHRU_PLUGIN_SUBSYSTEM,
"pam msg [%d] error [%s]\n", ii, msg[ii]->msg);
} else if (msg[ii]->msg_style == PAM_TEXT_INFO) {
slapi_log_error(SLAPI_LOG_PLUGIN, PAM_PASSTHRU_PLUGIN_SUBSYSTEM,
"pam msg [%d] text info [%s]\n", ii, msg[ii]->msg);
} else {
slapi_log_error(SLAPI_LOG_FATAL, PAM_PASSTHRU_PLUGIN_SUBSYSTEM,
"Error: unknown pam message type (%d: %s)\n",
msg[ii]->msg_style, msg[ii]->msg);
ret = PAM_CONV_ERR;
}
}
if (ret == PAM_CONV_ERR) {
free_pam_response(num_msg, reply);
reply = NULL;
}
*resp = reply;
return ret;
}
开发者ID:leto,项目名称:389-ds,代码行数:60,代码来源:pam_ptimpl.c
示例17: db_put_dn
void
db_put_dn(char *data_dn)
{
int ret;
DBT key = {0};
DBT data = {0};
if(db_lock == NULL){
db_lock = PR_NewLock();
}
PR_Lock(db_lock);
create_db();
if ((ret = DB_OPEN(dbp, NULL, DATABASE, NULL, DB_BTREE, DB_CREATE, 0664)) != 0) {
dbp->err(dbp, ret, "%s", DATABASE);
}
memset(&key, 0, sizeof(key));
memset(&data, 0, sizeof(data));
key.data = (char *)malloc(key_buffer_size);
/* make_key will set up the key and the data */
make_key(&key);
data.data = slapi_ch_strdup(data_dn);
data.size = strlen(data_dn);
switch (ret =
dbp->put(dbp, NULL, &key, &data, DB_NOOVERWRITE)) {
case 0:
slapi_log_error(SLAPI_LOG_PLUGIN, DB_PLUGIN_NAME, "db: %s: key stored.\n", (char *)key.data);
break;
case DB_KEYEXIST:
slapi_log_error(SLAPI_LOG_PLUGIN, DB_PLUGIN_NAME, "db: %s: key previously stored.\n",
(char *)key.data);
break;
default:
dbp->err(dbp, ret, "DB->put");
goto err;
}
err:
if(ret){
slapi_log_error(SLAPI_LOG_PLUGIN, DB_PLUGIN_NAME, "db: Error detected in db_put \n");
}
free(key.data);
if (dbp){
dbp->close(dbp,0);
dbp=NULL;
}
PR_Unlock(db_lock);
}
开发者ID:ohamada,项目名称:389ds,代码行数:54,代码来源:testdbinterop.c
示例18: new_factory_type
static struct factory_type*
new_factory_type(const char *name, size_t offset)
{
struct factory_type* ft= (struct factory_type*)slapi_ch_calloc(1, sizeof(struct factory_type));
ft->name= slapi_ch_strdup(name);
ft->extension_lock = PR_NewLock();
ft->extension_count= 0;
ft->extension_offset= offset;
ft->existence_count= 0;
return ft;
}
开发者ID:Firstyear,项目名称:ds,代码行数:11,代码来源:factory.c
示例19: ldbm_instance_config_instance_dir_get
static void *
ldbm_instance_config_instance_dir_get(void *arg)
{
ldbm_instance *inst = (ldbm_instance *)arg;
if (inst->inst_dir_name == NULL)
return slapi_ch_strdup("");
else if (inst->inst_parent_dir_name)
{
int len = strlen(inst->inst_parent_dir_name) +
strlen(inst->inst_dir_name) + 2;
char *full_inst_dir = (char *)slapi_ch_malloc(len);
PR_snprintf(full_inst_dir, len, "%s%c%s",
inst->inst_parent_dir_name, get_sep(inst->inst_parent_dir_name),
inst->inst_dir_name);
return full_inst_dir;
}
else
return slapi_ch_strdup(inst->inst_dir_name);
}
开发者ID:ohamada,项目名称:389ds,代码行数:20,代码来源:ldbm_instance_config.c
示例20: ldapmod_new_longlong
LDAPMod *
ldapmod_new_longlong(int op, const char *attr, long long value)
{
LDAPMod *mod;
mod = (LDAPMod*) slapi_ch_malloc(sizeof(LDAPMod));
mod->mod_op = op | LDAP_MOD_BVALUES;
mod->mod_type = slapi_ch_strdup(attr);
mod->mod_bvalues = bervals_new_longlong(value);
return mod;
}
开发者ID:AvidehST,项目名称:freeipa,代码行数:12,代码来源:ldapmod.c
注:本文中的slapi_ch_strdup函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论