/[monit]/monit/util.c
ViewVC logotype

Diff of /monit/util.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.90 by hauk, Fri Sep 19 03:44:17 2003 UTC revision 1.91 by martinp, Fri Sep 19 08:16:14 2003 UTC
# Line 1074  char *url_encode(char *uri) { Line 1074  char *url_encode(char *uri) {
1074  char *get_basic_authentication_header() {  char *get_basic_authentication_header() {
1075    
1076    if(Run.Auth.defined) {    if(Run.Auth.defined) {
1077        
1078      char *b64;      char *b64;
1079      char buf[STRLEN];      char  buf[STRLEN];
1080      char *auth= xmalloc(STRLEN+1);      char *auth= xmalloc(STRLEN+1);
1081        
1082      snprintf(buf, STRLEN, "%s:%s", Run.Auth.uname, Run.Auth.passwd);      snprintf(buf, STRLEN, "%s:%s", Run.Auth.uname, Run.Auth.passwd);
1083      encode_base64(&b64, strlen(buf), (unsigned char *) buf);  
1084        if(! (b64= encode_base64(strlen(buf), (unsigned char *)buf)) ) {
1085          log("Failed to base64 encode authentication header\n");
1086          return xstrdup("\r\n");
1087        }
1088    
1089      snprintf(auth, STRLEN, "Authorization: Basic %s\r\n", b64);      snprintf(auth, STRLEN, "Authorization: Basic %s\r\n", b64);
1090      free(b64);      free(b64);
1091        
1092      return auth;      return auth;
1093    
1094    }    }
1095          
1096    return xstrdup("\r\n");    return xstrdup("\r\n");
1097    
1098  }  }

Legend:
Removed from v.1.90  
changed lines
  Added in v.1.91

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26