From fcf1214a58b2e99a848e840cb38ae3cd354c4266 Mon Sep 17 00:00:00 2001 From: Noriko Hosoi Date: Jun 09 2007 00:27:20 +0000 Subject: Resolves: Bug 237356 Summary: Move DS Admin Code into Admin Server (Comment #42) Description: In the effort of using adminutil instead of the each server's local library (e.g., libds_admin), post_begin equivalent used in the DS code checks the return value from the function. Changing the return type from void to int to adjust. --- diff --git a/include/libadminutil/admutil.h b/include/libadminutil/admutil.h index 123f1b9..0231d00 100644 --- a/include/libadminutil/admutil.h +++ b/include/libadminutil/admutil.h @@ -21,7 +21,7 @@ /* * adminutil.h - prototypes for libadminutil * - * $Id: admutil.h,v 1.7 2007/05/15 00:53:33 nhosoi Exp $ + * $Id: admutil.h,v 1.8 2007/06/09 00:27:19 nhosoi Exp $ */ #ifndef __ADMUTIL_H__ @@ -444,7 +444,7 @@ PR_IMPLEMENT(void) get_begin(char *qs); /* Initialize a form "post" using the POST method. Send this fn "stdin". */ /* form_post.c */ -PR_IMPLEMENT(void) post_begin(FILE *in); +PR_IMPLEMENT(int) post_begin(FILE *in); /* Turn a variable string into a vars vector. */ /* form_post.c */ diff --git a/lib/libadminutil/form_post.c b/lib/libadminutil/form_post.c index 3c5d9b3..21602f5 100644 --- a/lib/libadminutil/form_post.c +++ b/lib/libadminutil/form_post.c @@ -176,13 +176,14 @@ form_unescape_url_escape_html(char *str) return rstr; } -PR_IMPLEMENT(void) +PR_IMPLEMENT(int) post_begin(FILE *in) { char *vars = NULL, *tmp = NULL; int cl; char buf1[BUFSIZ]; char buf2[BUFSIZ]; + int rc = 0; if(!(tmp = getenv("CONTENT_LENGTH"))) { if (admutil_i18nResource) { @@ -201,6 +202,7 @@ post_begin(FILE *in) "Your browser sent no content length with a POST command. Please be sure to use a fully compliant browser.", NULL); } + rc = 1; } cl = atoi(tmp); @@ -220,6 +222,7 @@ post_begin(FILE *in) "Could not allocate enough memory to read in the POST parameters.", NULL); } + rc = 1; } if( !(fread(vars, 1, cl, in)) ) { @@ -237,12 +240,14 @@ post_begin(FILE *in) "The POST variables could not be read from stdin.", NULL); } + rc = 1; } vars[cl] = '\0'; input = string_to_vec(vars); PL_strfree(vars); /* string_to_vec dups it */ + return rc; } PR_IMPLEMENT(void)