Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
f16f148f
Commit
f16f148f
authored
Aug 18, 2023
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use VENC instead of local b64 decoder.
parent
d4406492
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
134 deletions
+10
-134
Makefile.am
bin/varnishncsa/Makefile.am
+1
-3
b64.c
bin/varnishncsa/b64.c
+0
-90
b64.h
bin/varnishncsa/b64.h
+0
-34
varnishncsa.c
bin/varnishncsa/varnishncsa.c
+9
-7
No files found.
bin/varnishncsa/Makefile.am
View file @
f16f148f
...
...
@@ -8,9 +8,7 @@ bin_PROGRAMS = varnishncsa
varnishncsa_SOURCES
=
\
varnishncsa.c
\
varnishncsa_options.h
\
b64.h
\
b64.c
varnishncsa_options.h
varnishncsa_LDADD
=
\
$(top_builddir)
/lib/libvarnishapi/libvarnishapi.la
\
...
...
bin/varnishncsa/b64.c
deleted
100644 → 0
View file @
d4406492
/*
* Written by Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* This file is in the public domain.
*/
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include "b64.h"
static
const
char
b64
[]
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
;
static
char
i64
[
256
];
void
VB64_init
(
void
)
{
int
i
;
const
char
*
p
;
for
(
i
=
0
;
i
<
256
;
i
++
)
i64
[
i
]
=
-
1
;
for
(
p
=
b64
,
i
=
0
;
*
p
;
p
++
,
i
++
)
i64
[(
int
)
*
p
]
=
(
char
)
i
;
i64
[
'='
]
=
0
;
}
int
VB64_decode
(
char
*
d
,
unsigned
dlen
,
const
char
*
s
,
const
char
*
e
)
{
unsigned
u
,
v
,
l
;
int
i
;
if
(
e
==
NULL
)
e
=
s
+
strlen
(
s
);
u
=
0
;
l
=
0
;
while
(
s
<
e
)
{
for
(
v
=
0
;
s
<
e
&&
v
<
4
;
v
++
)
{
i
=
i64
[(
int
)
*
s
++
];
if
(
i
<
0
)
return
(
-
1
);
u
<<=
6
;
u
|=
i
;
}
for
(
v
=
0
;
v
<
3
;
v
++
)
{
if
(
l
>=
dlen
-
1
)
return
(
-
1
);
*
d
=
(
u
>>
16
)
&
0xff
;
u
<<=
8
;
l
++
;
d
++
;
}
}
*
d
=
'\0'
;
return
(
0
);
}
#ifdef TEST_DRIVER
#include <stdio.h> // for test-prog
const
char
*
test1
=
"TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlz"
"IHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2Yg"
"dGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGlu"
"dWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRo"
"ZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4="
;
int
main
(
int
argc
,
char
**
argv
)
{
int
i
;
char
buf
[
BUFSIZ
];
unsigned
l
;
(
void
)
argc
;
(
void
)
argv
;
VB64_init
();
l
=
sizeof
buf
;
VB64_decode
(
buf
,
l
,
test1
,
NULL
);
printf
(
"%s
\n
"
,
buf
);
return
(
0
);
}
#endif
bin/varnishncsa/b64.h
deleted
100644 → 0
View file @
d4406492
/*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2011 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
void
VB64_init
(
void
);
int
VB64_decode
(
char
*
d
,
unsigned
dlen
,
const
char
*
s
,
const
char
*
e
);
bin/varnishncsa/varnishncsa.c
View file @
f16f148f
...
...
@@ -58,10 +58,10 @@
#include "vdef.h"
#include "b64.h"
#include "vapi/vsl.h"
#include "vapi/voptget.h"
#include "vas.h"
#include "venc.h"
#include "vsb.h"
#include "vut.h"
#include "vqueue.h"
...
...
@@ -361,21 +361,24 @@ format_requestline(const struct format *format)
static
int
v_matchproto_
(
format_f
)
format_auth
(
const
struct
format
*
format
)
{
char
buf
[
128
];
struct
vsb
*
vsb
=
VSB_new_auto
();
AN
(
vsb
);
char
*
q
;
if
(
CTX
.
frag
[
F_auth
].
gen
!=
CTX
.
gen
||
V
B64_decode
(
buf
,
sizeof
buf
,
CTX
.
frag
[
F_auth
].
b
,
CTX
.
frag
[
F_auth
].
e
))
{
V
ENC_Decode_Base64
(
vsb
,
CTX
.
frag
[
F_auth
].
b
,
CTX
.
frag
[
F_auth
].
e
))
{
VSB_destroy
(
&
vsb
);
if
(
format
->
string
==
NULL
)
return
(
-
1
);
VSB_quote
(
CTX
.
vsb
,
format
->
string
,
-
1
,
CTX
.
quote_how
);
return
(
0
);
}
q
=
strchr
(
buf
,
':'
);
AZ
(
VSB_finish
(
vsb
));
q
=
strchr
(
VSB_data
(
vsb
),
':'
);
if
(
q
!=
NULL
)
*
q
=
'\0'
;
VSB_quote
(
CTX
.
vsb
,
buf
,
-
1
,
CTX
.
quote_how
);
VSB_quote
(
CTX
.
vsb
,
VSB_data
(
vsb
),
-
1
,
CTX
.
quote_how
);
VSB_destroy
(
&
vsb
);
return
(
1
);
}
...
...
@@ -1160,7 +1163,6 @@ main(int argc, char * const *argv)
VTAILQ_INIT
(
&
CTX
.
watch_vsl
);
CTX
.
vsb
=
VSB_new_auto
();
AN
(
CTX
.
vsb
);
VB64_init
();
CTX
.
quote_how
=
VSB_QUOTE_ESCHEX
;
REPLACE
(
CTX
.
missing_string
,
"-"
);
REPLACE
(
CTX
.
missing_int
,
"-"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment