diff options
author | Derrell Lipman <derrell@samba.org> | 2005-06-08 20:30:50 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:17:51 -0500 |
commit | 322f0df3f124c95f2f50abbb2c07616a6cf721c0 (patch) | |
tree | bf1343872926b92d90764a2df8a7e75a5c83c02e /source4/lib | |
parent | 7fc1c3553cd3666c234ec302a54ebd331589c934 (diff) | |
download | samba-322f0df3f124c95f2f50abbb2c07616a6cf721c0.tar.gz samba-322f0df3f124c95f2f50abbb2c07616a6cf721c0.tar.bz2 samba-322f0df3f124c95f2f50abbb2c07616a6cf721c0.zip |
r7410: minor cleanup
(This used to be commit 4c8bffc3f01d60ef7d8b75e92f4d062326288f4c)
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/ldb/common/ldb_explode_dn.c | 21 | ||||
-rw-r--r-- | source4/lib/ldb/include/ldb_explode_dn.h | 9 |
2 files changed, 18 insertions, 12 deletions
diff --git a/source4/lib/ldb/common/ldb_explode_dn.c b/source4/lib/ldb/common/ldb_explode_dn.c index db8e8f2a85..4e71bc70d1 100644 --- a/source4/lib/ldb/common/ldb_explode_dn.c +++ b/source4/lib/ldb/common/ldb_explode_dn.c @@ -386,10 +386,9 @@ ldb_explode_dn(void *mem_ctx, dest++; } src = component->attributes[i]->rdn; - do { - *(dest++) = *(src++); - } while(*src); - *dest = '\0'; + + /* we are guaranteed to have enough space in dest */ + strcpy(dest, src); } ldb_debug(mem_ctx, @@ -434,15 +433,17 @@ ldb_explode_dn(void *mem_ctx, /* copy the normalized components into the DN */ for (i = 0; i < dn->comp_num; i++) { + + /* add a separator between DN components */ if (i != 0) { - *dest = ','; - dest++; + *dest++ = ','; } + + /* point to this component of the DN */ src = dn->components[i]->component; - do { - *(dest++) = *(src++); - } while(*src); - *dest = '\0'; + + /* we are guaranteed to have enough space in dest */ + strcpy(dest, src); } ldb_debug(mem_ctx, LDB_DEBUG_TRACE, "dn: [%s]\n", dn->dn); diff --git a/source4/lib/ldb/include/ldb_explode_dn.h b/source4/lib/ldb/include/ldb_explode_dn.h index fb34be8b87..78768ebb80 100644 --- a/source4/lib/ldb/include/ldb_explode_dn.h +++ b/source4/lib/ldb/include/ldb_explode_dn.h @@ -32,7 +32,12 @@ struct ldb_dn_component { }; struct ldb_dn { - char *dn; - int comp_num; + char * dn; + int comp_num; struct ldb_dn_component ** components; }; + + +extern struct ldb_dn * +ldb_explode_dn(void *mem_ctx, + const char *orig_dn); |