summaryrefslogtreecommitdiffstats
path: root/helper.c
diff options
context:
space:
mode:
authorSimon Rettberg2014-03-18 19:32:40 +0100
committerSimon Rettberg2014-03-18 19:32:40 +0100
commitf0b46f7a343a79d1eeb29c0d45942df646e9cc35 (patch)
tree6969611ee51f412370c1c8b3171b6e9b72b4f551 /helper.c
parentFix double free in scan_ldapsearchfilter (diff)
downloadldadp-f0b46f7a343a79d1eeb29c0d45942df646e9cc35.tar.gz
ldadp-f0b46f7a343a79d1eeb29c0d45942df646e9cc35.tar.xz
ldadp-f0b46f7a343a79d1eeb29c0d45942df646e9cc35.zip
First working version with user and group support, login relaying
Diffstat (limited to 'helper.c')
-rw-r--r--helper.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/helper.c b/helper.c
index 1ba11b0..ff4d251 100644
--- a/helper.c
+++ b/helper.c
@@ -19,6 +19,8 @@ void bail(char *args, ...)
vprintf(args, argList);
va_end(argList);
printf("\n");
+ fflush(stdout);
+ fflush(stderr);
exit(1);
}
@@ -79,7 +81,7 @@ void helper_nonblock(const int fd)
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
}
-void helper_printava(struct AttributeValueAssertion* a,const char* rel)
+static void helper_printavaInt(struct AttributeValueAssertion* a,const char* rel)
{
putchar('[');
printf("%.*s", (int)a->desc.l,a->desc.s);
@@ -90,6 +92,12 @@ void helper_printava(struct AttributeValueAssertion* a,const char* rel)
putchar(']');
}
+void helper_printava(struct AttributeValueAssertion* a,const char* rel)
+{
+ helper_printavaInt(a, rel);
+ putchar('\n');
+}
+
void helper_printal(struct AttributeDescriptionList* a)
{
while (a) {
@@ -102,14 +110,14 @@ void helper_printal(struct AttributeDescriptionList* a)
putchar('\n');
}
-void helper_printfilter(struct Filter* f)
+static void helper_printfilterInt(struct Filter* f)
{
switch (f->type) {
case AND:
printf("&(");
mergesub:
- helper_printfilter(f->x);
- printf(")\n");
+ helper_printfilterInt(f->x);
+ printf(")");
break;
case OR:
printf("|(");
@@ -119,7 +127,7 @@ mergesub:
printf("!(");
goto mergesub;
case EQUAL:
- helper_printava(&f->ava,"==");
+ helper_printavaInt(&f->ava,"==");
break;
case SUBSTRING: {
struct Substring* s=f->substrings;
@@ -149,16 +157,16 @@ mergesub:
}
break;
case GREATEQUAL:
- helper_printava(&f->ava,">=");
+ helper_printavaInt(&f->ava,">=");
break;
case LESSEQUAL:
- helper_printava(&f->ava,"<=");
+ helper_printavaInt(&f->ava,"<=");
break;
case PRESENT:
- helper_printava(&f->ava,"\\exist");
+ helper_printavaInt(&f->ava,"\\exist");
break;
case APPROX:
- helper_printava(&f->ava,"\\approx");
+ helper_printavaInt(&f->ava,"\\approx");
break;
case EXTENSIBLE:
printf("[extensible]");
@@ -166,9 +174,13 @@ mergesub:
}
if (f->next) {
putchar(',');
- helper_printfilter(f->next);
+ helper_printfilterInt(f->next);
}
+}
+
+void helper_printfilter(struct Filter* f)
+{
+ helper_printfilterInt(f);
putchar('\n');
- fflush(stdout);
}