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 |
} |
} |