/* Utility Functions */
char *ssl_util_vhostid(apr_pool_t *, server_rec *);
-void ssl_util_strupper(char *);
-void ssl_util_uuencode(char *, const char *, BOOL);
-void ssl_util_uuencode_binary(unsigned char *, const unsigned char *, int, BOOL);
apr_file_t *ssl_util_ppopen(server_rec *, apr_pool_t *, const char *,
const char * const *);
void ssl_util_ppclose(server_rec *, apr_pool_t *, apr_file_t *);
BOOL ssl_util_path_check(ssl_pathcheck_t, const char *, apr_pool_t *);
ssl_algo_t ssl_util_algotypeof(X509 *, EVP_PKEY *);
char *ssl_util_algotypestr(ssl_algo_t);
-char *ssl_util_ptxtsub(apr_pool_t *, const char *, const char *, char *);
void ssl_util_thread_setup(apr_pool_t *);
int ssl_init_ssl_connection(conn_rec *c);
return id;
}
-void ssl_util_strupper(char *s)
-{
- for (; *s; ++s)
- *s = apr_toupper(*s);
- return;
-}
-
-static const char ssl_util_uuencode_six2pr[64+1] =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-void ssl_util_uuencode(char *szTo, const char *szFrom, BOOL bPad)
-{
- ssl_util_uuencode_binary((unsigned char *)szTo,
- (const unsigned char *)szFrom,
- strlen(szFrom), bPad);
-}
-
-void ssl_util_uuencode_binary(unsigned char *szTo,
- const unsigned char *szFrom,
- int nLength, BOOL bPad)
-{
- const unsigned char *s;
- int nPad = 0;
-
- for (s = szFrom; nLength > 0; s += 3) {
- *szTo++ = ssl_util_uuencode_six2pr[s[0] >> 2];
- *szTo++ = ssl_util_uuencode_six2pr[(s[0] << 4 | s[1] >> 4) & 0x3f];
- if (--nLength == 0) {
- nPad = 2;
- break;
- }
- *szTo++ = ssl_util_uuencode_six2pr[(s[1] << 2 | s[2] >> 6) & 0x3f];
- if (--nLength == 0) {
- nPad = 1;
- break;
- }
- *szTo++ = ssl_util_uuencode_six2pr[s[2] & 0x3f];
- --nLength;
- }
- while(bPad && nPad--) {
- *szTo++ = NUL;
- }
- *szTo = NUL;
- return;
-}
-
apr_file_t *ssl_util_ppopen(server_rec *s, apr_pool_t *p, const char *cmd,
const char * const *argv)
{
return cp;
}
-char *ssl_util_ptxtsub(apr_pool_t *p, const char *cpLine,
- const char *cpMatch, char *cpSubst)
-{
-#define MAX_PTXTSUB 100
- char *cppMatch[MAX_PTXTSUB];
- char *cpResult;
- int nResult;
- int nLine;
- int nSubst;
- int nMatch;
- char *cpI;
- char *cpO;
- char *cp;
- int i;
-
- /*
- * Pass 1: find substitution locations and calculate sizes
- */
- nLine = strlen(cpLine);
- nMatch = strlen(cpMatch);
- nSubst = strlen(cpSubst);
- for (cpI = (char *)cpLine, i = 0, nResult = 0;
- cpI < cpLine+nLine && i < MAX_PTXTSUB; ) {
- if ((cp = strstr(cpI, cpMatch)) != NULL) {
- cppMatch[i++] = cp;
- nResult += ((cp-cpI)+nSubst);
- cpI = (cp+nMatch);
- }
- else {
- nResult += strlen(cpI);
- break;
- }
- }
- cppMatch[i] = NULL;
- if (i == 0)
- return NULL;
-
- /*
- * Pass 2: allocate memory and assemble result
- */
- cpResult = apr_pcalloc(p, nResult+1);
- for (cpI = (char *)cpLine, cpO = cpResult, i = 0;
- cppMatch[i] != NULL;
- i++) {
- apr_cpystrn(cpO, cpI, cppMatch[i]-cpI+1);
- cpO += (cppMatch[i]-cpI);
- apr_cpystrn(cpO, cpSubst, nSubst+1);
- cpO += nSubst;
- cpI = (cppMatch[i]+nMatch);
- }
- apr_cpystrn(cpO, cpI, cpResult+nResult-cpO+1);
-
- return cpResult;
-}
-
/*
* certain key and cert data needs to survive restarts,
* which are stored in the user data table of s->process->pool.