#include <sys/select.h>
#endif
#if HAVE_FNMATCH_H
-extern "C"
-{
+extern "C" {
#include <fnmatch.h>
}
#endif
req->hostname,
req->action,
make_auth_header(req));
- write(s, buf, l);
- debug(1) fprintf(stderr, "wrote request: '%s'\n", buf);
+ if (write(s, buf, l) < 0) {
+ debug(1) fprintf(stderr, "ERROR: (%d) writing request: '%s'\n", errno, buf);
+ } else {
+ debug(1) fprintf(stderr, "wrote request: '%s'\n", buf);
+ }
return read_reply(s, req);
}
int
-main(int argc, char *argv[]) {
+main(int argc, char *argv[])
+{
char *s;
cachemgr_request *req;
}
static char *
-read_post_request(void) {
+read_post_request(void)
+{
char *s;
char *buf;
int len;
buf = (char *)xmalloc(len + 1);
- fread(buf, len, 1, stdin);
+ if (fread(buf, len, 1, stdin) == 0)
+ return NULL;
buf[len] = '\0';
}
static char *
-read_get_request(void) {
+read_get_request(void)
+{
char *s;
if ((s = getenv("QUERY_STRING")) == NULL)
}
static cachemgr_request *
-read_request(void) {
+read_request(void)
+{
char *buf;
cachemgr_request *req;
* Currently no powerful encryption is used.
*/
static void
-make_pub_auth(cachemgr_request * req) {
+make_pub_auth(cachemgr_request * req)
+{
static char buf[1024];
safe_free(req->pub_auth);
debug(3) fprintf(stderr, "cmgr: encoding for pub...\n");
}
static void
-decode_pub_auth(cachemgr_request * req) {
+decode_pub_auth(cachemgr_request * req)
+{
char *buf;
const char *host_name;
const char *time_str;
}
static void
-reset_auth(cachemgr_request * req) {
+reset_auth(cachemgr_request * req)
+{
safe_free(req->passwd);
safe_free(req->pub_auth);
}
static const char *
-make_auth_header(const cachemgr_request * req) {
+make_auth_header(const cachemgr_request * req)
+{
static char buf[1024];
size_t stringLength = 0;
const char *str64;
}
static int
-check_target_acl(const char *hostname, int port) {
+check_target_acl(const char *hostname, int port)
+{
char config_line[BUFSIZ];
FILE *fp = NULL;
int ret = 0;