Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
1f22d722
Commit
1f22d722
authored
Aug 20, 2009
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
http: Remove unused functions.
parent
94c27c0c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
205 deletions
+0
-205
modules/access/http.c
modules/access/http.c
+0
-205
No files found.
modules/access/http.c
View file @
1f22d722
...
...
@@ -1664,211 +1664,6 @@ static void cookie_append( vlc_array_t * cookies, char * cookie )
/*****************************************************************************
* HTTP authentication
*****************************************************************************/
static
char
*
AuthGetParam
(
const
char
*
psz_header
,
const
char
*
psz_param
)
{
char
psz_what
[
strlen
(
psz_param
)
+
3
];
sprintf
(
psz_what
,
"%s=
\"
"
,
psz_param
);
psz_header
=
strstr
(
psz_header
,
psz_what
);
if
(
psz_header
)
{
const
char
*
psz_end
;
psz_header
+=
strlen
(
psz_what
);
psz_end
=
strchr
(
psz_header
,
'"'
);
if
(
!
psz_end
)
/* Invalid since we should have a closing quote */
return
strdup
(
psz_header
);
return
strndup
(
psz_header
,
psz_end
-
psz_header
);
}
else
{
return
NULL
;
}
}
static
char
*
AuthGetParamNoQuotes
(
const
char
*
psz_header
,
const
char
*
psz_param
)
{
char
psz_what
[
strlen
(
psz_param
)
+
2
];
sprintf
(
psz_what
,
"%s="
,
psz_param
);
psz_header
=
strstr
(
psz_header
,
psz_what
);
if
(
psz_header
)
{
const
char
*
psz_end
;
psz_header
+=
strlen
(
psz_what
);
psz_end
=
strchr
(
psz_header
,
','
);
/* XXX: Do we need to filter out trailing space between the value and
* the comma/end of line? */
if
(
!
psz_end
)
/* Can be valid if this is the last parameter */
return
strdup
(
psz_header
);
return
strndup
(
psz_header
,
psz_end
-
psz_header
);
}
else
{
return
NULL
;
}
}
static
void
AuthParseHeader
(
access_t
*
p_access
,
const
char
*
psz_header
,
http_auth_t
*
p_auth
)
{
/* FIXME: multiple auth methods can be listed (comma seperated) */
/* 2 Basic Authentication Scheme */
if
(
!
strncasecmp
(
psz_header
,
"Basic "
,
strlen
(
"Basic "
)
)
)
{
msg_Dbg
(
p_access
,
"Using Basic Authentication"
);
psz_header
+=
strlen
(
"Basic "
);
p_auth
->
psz_realm
=
AuthGetParam
(
psz_header
,
"realm"
);
if
(
!
p_auth
->
psz_realm
)
msg_Warn
(
p_access
,
"Basic Authentication: "
"Mandatory 'realm' parameter is missing"
);
}
/* 3 Digest Access Authentication Scheme */
else
if
(
!
strncasecmp
(
psz_header
,
"Digest "
,
strlen
(
"Digest "
)
)
)
{
msg_Dbg
(
p_access
,
"Using Digest Access Authentication"
);
if
(
p_auth
->
psz_nonce
)
return
;
/* FIXME */
psz_header
+=
strlen
(
"Digest "
);
p_auth
->
psz_realm
=
AuthGetParam
(
psz_header
,
"realm"
);
p_auth
->
psz_domain
=
AuthGetParam
(
psz_header
,
"domain"
);
p_auth
->
psz_nonce
=
AuthGetParam
(
psz_header
,
"nonce"
);
p_auth
->
psz_opaque
=
AuthGetParam
(
psz_header
,
"opaque"
);
p_auth
->
psz_stale
=
AuthGetParamNoQuotes
(
psz_header
,
"stale"
);
p_auth
->
psz_algorithm
=
AuthGetParamNoQuotes
(
psz_header
,
"algorithm"
);
p_auth
->
psz_qop
=
AuthGetParam
(
psz_header
,
"qop"
);
p_auth
->
i_nonce
=
0
;
/* printf("realm: |%s|\ndomain: |%s|\nnonce: |%s|\nopaque: |%s|\n"
"stale: |%s|\nalgorithm: |%s|\nqop: |%s|\n",
p_auth->psz_realm,p_auth->psz_domain,p_auth->psz_nonce,
p_auth->psz_opaque,p_auth->psz_stale,p_auth->psz_algorithm,
p_auth->psz_qop); */
if
(
!
p_auth
->
psz_realm
)
msg_Warn
(
p_access
,
"Digest Access Authentication: "
"Mandatory 'realm' parameter is missing"
);
if
(
!
p_auth
->
psz_nonce
)
msg_Warn
(
p_access
,
"Digest Access Authentication: "
"Mandatory 'nonce' parameter is missing"
);
if
(
p_auth
->
psz_qop
)
/* FIXME: parse the qop list */
{
char
*
psz_tmp
=
strchr
(
p_auth
->
psz_qop
,
','
);
if
(
psz_tmp
)
*
psz_tmp
=
'\0'
;
}
}
else
{
const
char
*
psz_end
=
strchr
(
psz_header
,
' '
);
if
(
psz_end
)
msg_Warn
(
p_access
,
"Unknown authentication scheme: '%*s'"
,
(
int
)(
psz_end
-
psz_header
),
psz_header
);
else
msg_Warn
(
p_access
,
"Unknown authentication scheme: '%s'"
,
psz_header
);
}
}
static
char
*
AuthDigest
(
access_t
*
p_access
,
vlc_url_t
*
p_url
,
http_auth_t
*
p_auth
,
const
char
*
psz_method
)
{
(
void
)
p_access
;
const
char
*
psz_username
=
p_url
->
psz_username
?
p_url
->
psz_username
:
""
;
const
char
*
psz_password
=
p_url
->
psz_password
?
p_url
->
psz_password
:
""
;
char
*
psz_HA1
=
NULL
;
char
*
psz_HA2
=
NULL
;
char
*
psz_response
=
NULL
;
struct
md5_s
md5
;
/* H(A1) */
if
(
p_auth
->
psz_HA1
)
{
psz_HA1
=
strdup
(
p_auth
->
psz_HA1
);
if
(
!
psz_HA1
)
goto
error
;
}
else
{
InitMD5
(
&
md5
);
AddMD5
(
&
md5
,
psz_username
,
strlen
(
psz_username
)
);
AddMD5
(
&
md5
,
":"
,
1
);
AddMD5
(
&
md5
,
p_auth
->
psz_realm
,
strlen
(
p_auth
->
psz_realm
)
);
AddMD5
(
&
md5
,
":"
,
1
);
AddMD5
(
&
md5
,
psz_password
,
strlen
(
psz_password
)
);
EndMD5
(
&
md5
);
psz_HA1
=
psz_md5_hash
(
&
md5
);
if
(
!
psz_HA1
)
goto
error
;
if
(
p_auth
->
psz_algorithm
&&
!
strcmp
(
p_auth
->
psz_algorithm
,
"MD5-sess"
)
)
{
InitMD5
(
&
md5
);
AddMD5
(
&
md5
,
psz_HA1
,
32
);
free
(
psz_HA1
);
AddMD5
(
&
md5
,
":"
,
1
);
AddMD5
(
&
md5
,
p_auth
->
psz_nonce
,
strlen
(
p_auth
->
psz_nonce
)
);
AddMD5
(
&
md5
,
":"
,
1
);
AddMD5
(
&
md5
,
p_auth
->
psz_cnonce
,
strlen
(
p_auth
->
psz_cnonce
)
);
EndMD5
(
&
md5
);
psz_HA1
=
psz_md5_hash
(
&
md5
);
if
(
!
psz_HA1
)
goto
error
;
p_auth
->
psz_HA1
=
strdup
(
psz_HA1
);
if
(
!
p_auth
->
psz_HA1
)
goto
error
;
}
}
/* H(A2) */
InitMD5
(
&
md5
);
if
(
*
psz_method
)
AddMD5
(
&
md5
,
psz_method
,
strlen
(
psz_method
)
);
AddMD5
(
&
md5
,
":"
,
1
);
if
(
p_url
->
psz_path
)
AddMD5
(
&
md5
,
p_url
->
psz_path
,
strlen
(
p_url
->
psz_path
)
);
else
AddMD5
(
&
md5
,
"/"
,
1
);
if
(
p_auth
->
psz_qop
&&
!
strcmp
(
p_auth
->
psz_qop
,
"auth-int"
)
)
{
char
*
psz_ent
;
struct
md5_s
ent
;
InitMD5
(
&
ent
);
AddMD5
(
&
ent
,
""
,
0
);
/* XXX: entity-body. should be ok for GET */
EndMD5
(
&
ent
);
psz_ent
=
psz_md5_hash
(
&
ent
);
if
(
!
psz_ent
)
goto
error
;
AddMD5
(
&
md5
,
":"
,
1
);
AddMD5
(
&
md5
,
psz_ent
,
32
);
free
(
psz_ent
);
}
EndMD5
(
&
md5
);
psz_HA2
=
psz_md5_hash
(
&
md5
);
if
(
!
psz_HA2
)
goto
error
;
/* Request digest */
InitMD5
(
&
md5
);
AddMD5
(
&
md5
,
psz_HA1
,
32
);
AddMD5
(
&
md5
,
":"
,
1
);
AddMD5
(
&
md5
,
p_auth
->
psz_nonce
,
strlen
(
p_auth
->
psz_nonce
)
);
AddMD5
(
&
md5
,
":"
,
1
);
if
(
p_auth
->
psz_qop
&&
(
!
strcmp
(
p_auth
->
psz_qop
,
"auth"
)
||
!
strcmp
(
p_auth
->
psz_qop
,
"auth-int"
)
)
)
{
char
psz_inonce
[
9
];
snprintf
(
psz_inonce
,
9
,
"%08x"
,
p_auth
->
i_nonce
);
AddMD5
(
&
md5
,
psz_inonce
,
8
);
AddMD5
(
&
md5
,
":"
,
1
);
AddMD5
(
&
md5
,
p_auth
->
psz_cnonce
,
strlen
(
p_auth
->
psz_cnonce
)
);
AddMD5
(
&
md5
,
":"
,
1
);
AddMD5
(
&
md5
,
p_auth
->
psz_qop
,
strlen
(
p_auth
->
psz_qop
)
);
AddMD5
(
&
md5
,
":"
,
1
);
}
AddMD5
(
&
md5
,
psz_HA2
,
32
);
EndMD5
(
&
md5
);
psz_response
=
psz_md5_hash
(
&
md5
);
error:
free
(
psz_HA1
);
free
(
psz_HA2
);
return
psz_response
;
}
static
void
AuthReply
(
access_t
*
p_access
,
const
char
*
psz_prefix
,
vlc_url_t
*
p_url
,
http_auth_t
*
p_auth
)
...
...
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