summaryrefslogtreecommitdiffstats
path: root/source4
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2012-04-15 14:02:41 -0700
committerMatthieu Patou <mat@matws.net>2012-05-05 17:26:10 -0700
commitaae8085c618e3b4a994a5316596f031701b0529f (patch)
treedd3926462714141703da74950b7847345a92768a /source4
parent16a24dc182edc020cb1a209db80649efe9bb5488 (diff)
downloadsamba-aae8085c618e3b4a994a5316596f031701b0529f.tar.gz
samba-aae8085c618e3b4a994a5316596f031701b0529f.tar.xz
samba-aae8085c618e3b4a994a5316596f031701b0529f.zip
olschema2ldif: be more strict where checking for open/closed braces
Diffstat (limited to 'source4')
-rw-r--r--source4/utils/oLschema2ldif.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/source4/utils/oLschema2ldif.c b/source4/utils/oLschema2ldif.c
index ae69db19bc..be86daafb7 100644
--- a/source4/utils/oLschema2ldif.c
+++ b/source4/utils/oLschema2ldif.c
@@ -82,7 +82,12 @@ static int check_braces(const char *string)
c = strpbrk(c, "()");
if (c == NULL) return 1;
if (*c == '(') b++;
- if (*c == ')') b--;
+ if (*c == ')') {
+ b--;
+ if (*(c - 1) != ' ' && c && (*(c + 1) == '\0')) {
+ return 2;
+ }
+ }
c++;
}
return 0;
@@ -538,8 +543,10 @@ static struct schema_conv process_file(FILE *in, FILE *out)
do {
if (c == '\n') {
- entry[t] = '\0';
- if (check_braces(entry) == 0) {
+ int ret2 = 0;
+ entry[t] = '\0';
+ ret2 = check_braces(entry);
+ if (ret2 == 0) {
ret.count++;
ldif.msg = process_entry(ctx, entry);
if (ldif.msg == NULL) {
@@ -550,6 +557,11 @@ static struct schema_conv process_file(FILE *in, FILE *out)
ldb_ldif_write_file(ldb_ctx, out, &ldif);
break;
}
+ if (ret2 == 2) {
+ fprintf(stderr, "Invalid entry %s, closing braces needs to be preceeded by a space\n", entry);
+ ret.failures++;
+ break;
+ }
line++;
} else {
entry[t] = c;