From f0b46f7a343a79d1eeb29c0d45942df646e9cc35 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 18 Mar 2014 19:32:40 +0100 Subject: First working version with user and group support, login relaying --- helper.c | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'helper.c') 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); } -- cgit v1.2.3-55-g7522