Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenLDAP
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Christopher Ng
OpenLDAP
Commits
943cfaf4
Commit
943cfaf4
authored
26 years ago
by
Juan Gomez
Browse files
Options
Downloads
Patches
Plain Diff
Added get_next_substring(), rdn_attr_type(), and rdn_attr_value() which
are needed in the implementation of modrdn v3.
parent
ce6836db
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
servers/slapd/dn.c
+98
-0
98 additions, 0 deletions
servers/slapd/dn.c
with
98 additions
and
0 deletions
servers/slapd/dn.c
+
98
−
0
View file @
943cfaf4
...
...
@@ -342,3 +342,101 @@ dn_upcase( char *dn )
return
(
dn
);
}
/*
* get_next_substring(), rdn_attr_type(), and rdn_attr_value()
*
* Copyright 1999, Juan C. Gomez, All rights reserved.
* This software is not subject to any license of Silicon Graphics
* Inc. or Purdue University.
*
* Redistribution and use in source and binary forms are permitted
* without restriction or fee of any kind as long as this notice
* is preserved.
*
*/
/* get_next_substring:
*
* Gets next substring in s, using d (or the end of the string '\0') as a
* string delimiter, and places it in a duplicated memory space. Leading
* spaces are ignored. String s **must** be null-terminated.
*/
static
char
*
get_next_substring
(
char
*
s
,
char
d
)
{
char
*
str
,
*
r
;
r
=
str
=
ch_malloc
(
strlen
(
s
)
+
1
);
/* Skip leading spaces */
while
(
*
s
&&
SPACE
(
*
s
)
)
{
s
++
;
}
/* while ( *s && SPACE(*s) ) */
/* Copy word */
while
(
*
s
&&
(
*
s
!=
d
)
)
{
/* Don't stop when you see trailing spaces may be a multi-word
* string, i.e. name=John Doe!
*/
*
str
++
=
*
s
++
;
}
/* while ( *s && (*s != d) ) */
*
str
=
'\0'
;
return
r
;
}
/* char * get_word() */
/* rdn_attr_type:
*
* Given a string (i.e. an rdn) of the form:
* "attribute_type = attribute_value"
* this function returns the type of an attribute, that is the
* string "attribute_type" which is placed in newly allocated
* memory. The returned string will be null-terminated.
*/
char
*
rdn_attr_type
(
char
*
s
)
{
return
get_next_substring
(
s
,
'='
);
}
/* char * rdn_attr_type() */
/* rdn_attr_value:
*
* Given a string (i.e. an rdn) of the form:
* "attribute_type = attribute_value"
* this function returns "attribute_type" which is placed in newly allocated
* memory. The returned string will be null-terminated and may contain
* spaces (i.e. "John Doe\0").
*/
char
*
rdn_attr_value
(
char
*
rdn
)
{
char
*
str
;
if
(
(
str
=
strchr
(
rdn
,
'='
))
!=
NULL
)
{
return
get_next_substring
(
++
str
,
'\0'
);
}
/* if ( (str = strpbrk( rdn, "=" )) != NULL ) */
return
NULL
;
}
/* char * rdn_attr_value() */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment