Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Marvin Scholz
Icecast-Server
Commits
7ae46647
Commit
7ae46647
authored
Oct 09, 2014
by
Philipp Schafft
🦁
Browse files
Replace the old logging macros with variadic argument macros. (patch by ePirat) (close #2058)
svn path=/icecast/trunk/icecast/; revision=19229
parent
093b9439
Changes
32
Hide whitespace changes
Inline
Side-by-side
src/admin.c
View file @
7ae46647
...
...
@@ -300,7 +300,7 @@ void admin_send_response (xmlDocPtr doc, client_t *client,
config
->
adminroot_dir
,
PATH_SEPARATOR
,
xslt_template
);
config_release_config
();
DEBUG
1
(
"Sending XSLT (%s)"
,
fullpath_xslt_template
);
LOG_
DEBUG
(
"Sending XSLT (%s)"
,
fullpath_xslt_template
);
xslt_transform
(
doc
,
fullpath_xslt_template
,
client
);
free
(
fullpath_xslt_template
);
}
...
...
@@ -312,10 +312,10 @@ void admin_handle_request(client_t *client, const char *uri)
const
char
*
mount
,
*
command_string
;
int
command
;
DEBUG
1
(
"Admin request (%s)"
,
uri
);
LOG_
DEBUG
(
"Admin request (%s)"
,
uri
);
if
(
!
((
strcmp
(
uri
,
"/admin.cgi"
)
==
0
)
||
(
strncmp
(
"/admin/"
,
uri
,
7
)
==
0
)))
{
ERROR
0
(
"Internal error: admin request isn't"
);
LOG_
ERROR
(
"Internal error: admin request isn't"
);
client_send_401
(
client
);
return
;
}
...
...
@@ -327,11 +327,11 @@ void admin_handle_request(client_t *client, const char *uri)
command_string
=
uri
+
7
;
}
DEBUG
1
(
"Got command (%s)"
,
command_string
);
LOG_
DEBUG
(
"Got command (%s)"
,
command_string
);
command
=
admin_get_command
(
command_string
);
if
(
command
<
0
)
{
ERROR
1
(
"Error parsing command string or unrecognised command: %s"
,
LOG_
ERROR
(
"Error parsing command string or unrecognised command: %s"
,
command_string
);
client_send_400
(
client
,
"Unrecognised command"
);
return
;
...
...
@@ -383,7 +383,7 @@ void admin_handle_request(client_t *client, const char *uri)
case
0
:
break
;
default:
INFO
1
(
"Bad or missing password on mount modification admin "
LOG_
INFO
(
"Bad or missing password on mount modification admin "
"request (command: %s)"
,
command_string
);
client_send_401
(
client
);
/* fall through */
...
...
@@ -397,7 +397,7 @@ void admin_handle_request(client_t *client, const char *uri)
if
(
source
==
NULL
)
{
WARN
2
(
"Admin command %s on non-existent source %s"
,
LOG_
WARN
(
"Admin command %s on non-existent source %s"
,
command_string
,
mount
);
avl_tree_unlock
(
global
.
source_tree
);
client_send_400
(
client
,
"Source does not exist"
);
...
...
@@ -407,7 +407,7 @@ void admin_handle_request(client_t *client, const char *uri)
if
(
source
->
running
==
0
&&
source
->
on_demand
==
0
)
{
avl_tree_unlock
(
global
.
source_tree
);
INFO
2
(
"Received admin command %s on unavailable mount
\"
%s
\"
"
,
LOG_
INFO
(
"Received admin command %s on unavailable mount
\"
%s
\"
"
,
command_string
,
mount
);
client_send_400
(
client
,
"Source is not available"
);
return
;
...
...
@@ -416,12 +416,12 @@ void admin_handle_request(client_t *client, const char *uri)
source
->
shoutcast_compat
==
0
)
{
avl_tree_unlock
(
global
.
source_tree
);
ERROR
0
(
"illegal change of metadata on non-shoutcast "
LOG_
ERROR
(
"illegal change of metadata on non-shoutcast "
"compatible stream"
);
client_send_400
(
client
,
"illegal metadata call"
);
return
;
}
INFO
2
(
"Received admin command %s on mount
\"
%s
\"
"
,
LOG_
INFO
(
"Received admin command %s on mount
\"
%s
\"
"
,
command_string
,
mount
);
admin_handle_mount_request
(
client
,
source
,
command
);
avl_tree_unlock
(
global
.
source_tree
);
...
...
@@ -434,7 +434,7 @@ void admin_handle_request(client_t *client, const char *uri)
mounts from the master, so handle this request
validating against the relay password */
if
(
!
connection_check_relay_pass
(
client
->
parser
))
{
INFO
1
(
"Bad or missing password on admin command "
LOG_
INFO
(
"Bad or missing password on admin command "
"request (command: %s)"
,
command_string
);
client_send_401
(
client
);
return
;
...
...
@@ -442,7 +442,7 @@ void admin_handle_request(client_t *client, const char *uri)
}
else
{
if
(
!
connection_check_admin_pass
(
client
->
parser
))
{
INFO
1
(
"Bad or missing password on admin command "
LOG_
INFO
(
"Bad or missing password on admin command "
"request (command: %s)"
,
command_string
);
client_send_401
(
client
);
return
;
...
...
@@ -481,7 +481,7 @@ static void admin_handle_general_request(client_t *client, int command)
command_list_mounts
(
client
,
TRANSFORMED
);
break
;
default:
WARN
0
(
"General admin request not recognised"
);
LOG_
WARN
(
"General admin request not recognised"
);
client_send_400
(
client
,
"Unknown admin request"
);
return
;
}
...
...
@@ -549,7 +549,7 @@ static void admin_handle_mount_request(client_t *client, source_t *source,
command_updatemetadata
(
client
,
source
,
RAW
);
break
;
default:
WARN
0
(
"Mount request not recognised"
);
LOG_
WARN
(
"Mount request not recognised"
);
client_send_400
(
client
,
"Mount request unknown"
);
break
;
}
...
...
@@ -594,11 +594,11 @@ static void command_move_clients(client_t *client, source_t *source,
char
buf
[
255
];
int
parameters_passed
=
0
;
DEBUG
0
(
"Doing optional check"
);
LOG_
DEBUG
(
"Doing optional check"
);
if
((
COMMAND_OPTIONAL
(
client
,
"destination"
,
dest_source
)))
{
parameters_passed
=
1
;
}
DEBUG
1
(
"Done optional check (%d)"
,
parameters_passed
);
LOG_
DEBUG
(
"Done optional check (%d)"
,
parameters_passed
);
if
(
!
parameters_passed
)
{
doc
=
admin_build_sourcelist
(
source
->
mount
);
admin_send_response
(
doc
,
client
,
response
,
...
...
@@ -627,7 +627,7 @@ static void command_move_clients(client_t *client, source_t *source,
return
;
}
INFO
2
(
"source is
\"
%s
\"
, destination is
\"
%s
\"
"
,
source
->
mount
,
dest
->
mount
);
LOG_
INFO
(
"source is
\"
%s
\"
, destination is
\"
%s
\"
"
,
source
->
mount
,
dest
->
mount
);
doc
=
xmlNewDoc
(
XMLSTR
(
"1.0"
));
node
=
xmlNewDocNode
(
doc
,
NULL
,
XMLSTR
(
"iceresponse"
),
NULL
);
...
...
@@ -748,7 +748,7 @@ static void command_manageauth(client_t *client, source_t *source,
{
if
(
mountinfo
==
NULL
||
mountinfo
->
auth
==
NULL
)
{
WARN
1
(
"manage auth request for %s but no facility available"
,
source
->
mount
);
LOG_
WARN
(
"manage auth request for %s but no facility available"
,
source
->
mount
);
break
;
}
COMMAND_OPTIONAL
(
client
,
"action"
,
action
);
...
...
@@ -764,7 +764,7 @@ static void command_manageauth(client_t *client, source_t *source,
if
(
username
==
NULL
||
password
==
NULL
)
{
WARN
1
(
"manage auth request add for %s but no user/pass"
,
source
->
mount
);
LOG_
WARN
(
"manage auth request add for %s but no user/pass"
,
source
->
mount
);
break
;
}
ret
=
mountinfo
->
auth
->
adduser
(
mountinfo
->
auth
,
username
,
password
);
...
...
@@ -782,7 +782,7 @@ static void command_manageauth(client_t *client, source_t *source,
{
if
(
username
==
NULL
)
{
WARN
1
(
"manage auth request delete for %s but no username"
,
source
->
mount
);
LOG_
WARN
(
"manage auth request delete for %s but no username"
,
source
->
mount
);
break
;
}
ret
=
mountinfo
->
auth
->
deleteuser
(
mountinfo
->
auth
,
username
);
...
...
@@ -860,10 +860,10 @@ static void command_kill_client(client_t *client, source_t *source,
doc
=
xmlNewDoc
(
XMLSTR
(
"1.0"
));
node
=
xmlNewDocNode
(
doc
,
NULL
,
XMLSTR
(
"iceresponse"
),
NULL
);
xmlDocSetRootElement
(
doc
,
node
);
DEBUG
1
(
"Response is %d"
,
response
);
LOG_
DEBUG
(
"Response is %d"
,
response
);
if
(
listener
!=
NULL
)
{
INFO
1
(
"Admin request: client %d removed"
,
id
);
LOG_
INFO
(
"Admin request: client %d removed"
,
id
);
/* This tags it for removal on the next iteration of the main source
* loop
...
...
@@ -891,7 +891,7 @@ static void command_fallback(client_t *client, source_t *source,
const
char
*
fallback
;
char
*
old
;
DEBUG
0
(
"Got fallback request"
);
LOG_
DEBUG
(
"Got fallback request"
);
COMMAND_REQUIRE
(
client
,
"fallback"
,
fallback
);
...
...
@@ -916,7 +916,7 @@ static void command_metadata(client_t *client, source_t *source,
node
=
xmlNewDocNode
(
doc
,
NULL
,
XMLSTR
(
"iceresponse"
),
NULL
);
xmlDocSetRootElement
(
doc
,
node
);
DEBUG
0
(
"Got metadata update request"
);
LOG_
DEBUG
(
"Got metadata update request"
);
COMMAND_REQUIRE
(
client
,
"mode"
,
action
);
COMMAND_OPTIONAL
(
client
,
"song"
,
song
);
...
...
@@ -944,7 +944,7 @@ static void command_metadata(client_t *client, source_t *source,
if
(
song
)
{
plugin
->
set_tag
(
plugin
,
"song"
,
song
,
charset
);
INFO
2
(
"Metadata on mountpoint %s changed to
\"
%s
\"
"
,
source
->
mount
,
song
);
LOG_
INFO
(
"Metadata on mountpoint %s changed to
\"
%s
\"
"
,
source
->
mount
,
song
);
}
else
{
...
...
@@ -952,7 +952,7 @@ static void command_metadata(client_t *client, source_t *source,
{
plugin
->
set_tag
(
plugin
,
"title"
,
title
,
charset
);
plugin
->
set_tag
(
plugin
,
"artist"
,
artist
,
charset
);
INFO
3
(
"Metadata on mountpoint %s changed to
\"
%s - %s
\"
"
,
LOG_
INFO
(
"Metadata on mountpoint %s changed to
\"
%s - %s
\"
"
,
source
->
mount
,
artist
,
title
);
}
}
...
...
@@ -983,7 +983,7 @@ static void command_shoutcast_metadata(client_t *client, source_t *source)
const
char
*
value
;
int
same_ip
=
1
;
DEBUG
0
(
"Got shoutcast metadata update request"
);
LOG_
DEBUG
(
"Got shoutcast metadata update request"
);
COMMAND_REQUIRE
(
client
,
"mode"
,
action
);
COMMAND_REQUIRE
(
client
,
"song"
,
value
);
...
...
@@ -1002,7 +1002,7 @@ static void command_shoutcast_metadata(client_t *client, source_t *source)
source
->
format
->
set_tag
(
source
->
format
,
"title"
,
value
,
NULL
);
source
->
format
->
set_tag
(
source
->
format
,
NULL
,
NULL
,
NULL
);
DEBUG
2
(
"Metadata on mountpoint %s changed to
\"
%s
\"
"
,
LOG_
DEBUG
(
"Metadata on mountpoint %s changed to
\"
%s
\"
"
,
source
->
mount
,
value
);
html_success
(
client
,
"Metadata update successful"
);
}
...
...
@@ -1015,7 +1015,7 @@ static void command_shoutcast_metadata(client_t *client, source_t *source)
static
void
command_stats
(
client_t
*
client
,
const
char
*
mount
,
int
response
)
{
xmlDocPtr
doc
;
DEBUG
0
(
"Stats request, sending xml stats"
);
LOG_
DEBUG
(
"Stats request, sending xml stats"
);
doc
=
stats_get_xml
(
1
,
mount
);
admin_send_response
(
doc
,
client
,
response
,
STATS_TRANSFORMED_REQUEST
);
...
...
@@ -1025,7 +1025,7 @@ static void command_stats(client_t *client, const char *mount, int response) {
static
void
command_list_mounts
(
client_t
*
client
,
int
response
)
{
DEBUG
0
(
"List mounts request"
);
LOG_
DEBUG
(
"List mounts request"
);
if
(
response
==
PLAINTEXT
)
{
...
...
src/auth.c
View file @
7ae46647
...
...
@@ -59,7 +59,7 @@ static auth_client *auth_client_setup (const char *mount, client_t *client)
userpass
=
util_base64_decode
(
header
+
6
);
if
(
userpass
==
NULL
)
{
WARN
1
(
"Base64 decode of Authorization header
\"
%s
\"
failed"
,
LOG_
WARN
(
"Base64 decode of Authorization header
\"
%s
\"
failed"
,
header
+
6
);
break
;
}
...
...
@@ -79,7 +79,7 @@ static auth_client *auth_client_setup (const char *mount, client_t *client)
free
(
userpass
);
break
;
}
INFO
1
(
"unhandled authorization header: %s"
,
header
);
LOG_
INFO
(
"unhandled authorization header: %s"
,
header
);
}
while
(
0
);
...
...
@@ -109,17 +109,17 @@ static void queue_auth_client (auth_client *auth_user, mount_proxy *mountinfo)
{
if
(
auth_user
->
client
==
NULL
||
auth_user
->
client
->
auth
==
NULL
)
{
WARN
1
(
"internal state is incorrect for %p"
,
auth_user
->
client
);
LOG_
WARN
(
"internal state is incorrect for %p"
,
auth_user
->
client
);
return
;
}
auth
=
auth_user
->
client
->
auth
;
thread_mutex_lock
(
&
auth
->
lock
);
}
DEBUG
2
(
"...refcount on auth_t %s is now %d"
,
auth
->
mount
,
auth
->
refcount
);
LOG_
DEBUG
(
"...refcount on auth_t %s is now %d"
,
auth
->
mount
,
auth
->
refcount
);
*
auth
->
tailp
=
auth_user
;
auth
->
tailp
=
&
auth_user
->
next
;
auth
->
pending_count
++
;
INFO
2
(
"auth on %s has %d pending"
,
auth
->
mount
,
auth
->
pending_count
);
LOG_
INFO
(
"auth on %s has %d pending"
,
auth
->
mount
,
auth
->
pending_count
);
thread_mutex_unlock
(
&
auth
->
lock
);
}
...
...
@@ -134,7 +134,7 @@ void auth_release (auth_t *authenticator)
thread_mutex_lock
(
&
authenticator
->
lock
);
authenticator
->
refcount
--
;
DEBUG
2
(
"...refcount on auth_t %s is now %d"
,
authenticator
->
mount
,
authenticator
->
refcount
);
LOG_
DEBUG
(
"...refcount on auth_t %s is now %d"
,
authenticator
->
mount
,
authenticator
->
refcount
);
if
(
authenticator
->
refcount
)
{
thread_mutex_unlock
(
&
authenticator
->
lock
);
...
...
@@ -198,7 +198,7 @@ static void auth_new_listener (auth_t *auth, auth_client *auth_user)
* can be avoided if client has disconnected */
if
(
is_listener_connected
(
client
)
==
0
)
{
DEBUG
0
(
"listener is no longer connected"
);
LOG_
DEBUG
(
"listener is no longer connected"
);
client
->
respcode
=
400
;
auth_release
(
client
->
auth
);
client
->
auth
=
NULL
;
...
...
@@ -217,7 +217,7 @@ static void auth_new_listener (auth_t *auth, auth_client *auth_user)
{
auth_release
(
client
->
auth
);
client
->
auth
=
NULL
;
INFO
1
(
"client %lu failed"
,
client
->
con
->
id
);
LOG_
INFO
(
"client %lu failed"
,
client
->
con
->
id
);
}
}
...
...
@@ -252,7 +252,7 @@ static void stream_auth_callback (auth_t *auth, auth_client *auth_user)
if
(
client
->
authenticated
)
auth_postprocess_source
(
auth_user
);
else
WARN
1
(
"Failed auth for source
\"
%s
\"
"
,
auth_user
->
mount
);
LOG_
WARN
(
"Failed auth for source
\"
%s
\"
"
,
auth_user
->
mount
);
}
...
...
@@ -283,7 +283,7 @@ static void *auth_run_thread (void *arg)
{
auth_t
*
auth
=
arg
;
INFO
0
(
"Authentication thread started"
);
LOG_
INFO
(
"Authentication thread started"
);
while
(
auth
->
running
)
{
/* usually no clients are waiting, so don't bother taking locks */
...
...
@@ -299,7 +299,7 @@ static void *auth_run_thread (void *arg)
thread_mutex_unlock
(
&
auth
->
lock
);
continue
;
}
DEBUG
2
(
"%d client(s) pending on %s"
,
auth
->
pending_count
,
auth
->
mount
);
LOG_
DEBUG
(
"%d client(s) pending on %s"
,
auth
->
pending_count
,
auth
->
mount
);
auth
->
head
=
auth_user
->
next
;
if
(
auth
->
head
==
NULL
)
auth
->
tailp
=
&
auth
->
head
;
...
...
@@ -310,7 +310,7 @@ static void *auth_run_thread (void *arg)
if
(
auth_user
->
process
)
auth_user
->
process
(
auth
,
auth_user
);
else
ERROR
0
(
"client auth process not set"
);
LOG_
ERROR
(
"client auth process not set"
);
auth_client_free
(
auth_user
);
...
...
@@ -318,7 +318,7 @@ static void *auth_run_thread (void *arg)
}
thread_sleep
(
150000
);
}
INFO
0
(
"Authenication thread shutting down"
);
LOG_
INFO
(
"Authenication thread shutting down"
);
return
NULL
;
}
...
...
@@ -379,7 +379,7 @@ static int add_listener_to_source (source_t *source, client_t *client)
int
loop
=
10
;
do
{
DEBUG
3
(
"max on %s is %ld (cur %lu)"
,
source
->
mount
,
LOG_
DEBUG
(
"max on %s is %ld (cur %lu)"
,
source
->
mount
,
source
->
max_listeners
,
source
->
listeners
);
if
(
source
->
max_listeners
==
-
1
)
break
;
...
...
@@ -390,12 +390,12 @@ static int add_listener_to_source (source_t *source, client_t *client)
{
source_t
*
next
=
source_find_mount
(
source
->
fallback_mount
);
if
(
!
next
)
{
ERROR
2
(
"Fallback '%s' for full source '%s' not found"
,
LOG_
ERROR
(
"Fallback '%s' for full source '%s' not found"
,
source
->
mount
,
source
->
fallback_mount
);
return
-
1
;
}
INFO
1
(
"stream full trying %s"
,
next
->
mount
);
LOG_
INFO
(
"stream full trying %s"
,
next
->
mount
);
source
=
next
;
loop
--
;
continue
;
...
...
@@ -418,10 +418,10 @@ static int add_listener_to_source (source_t *source, client_t *client)
if
(
source
->
running
==
0
&&
source
->
on_demand
)
{
/* enable on-demand relay to start, wake up the slave thread */
DEBUG
0
(
"kicking off on-demand relay"
);
LOG_
DEBUG
(
"kicking off on-demand relay"
);
source
->
on_demand_req
=
1
;
}
DEBUG
1
(
"Added client to %s"
,
source
->
mount
);
LOG_
DEBUG
(
"Added client to %s"
,
source
->
mount
);
return
0
;
}
...
...
@@ -442,7 +442,7 @@ static int add_authenticated_listener (const char *mount, mount_proxy *mountinfo
if
(
util_check_valid_extension
(
mount
)
==
XSLT_CONTENT
)
{
/* If the file exists, then transform it, otherwise, write a 404 */
DEBUG
0
(
"Stats request, sending XSL transformed stats"
);
LOG_
DEBUG
(
"Stats request, sending XSL transformed stats"
);
stats_transform_xslt
(
client
,
mount
);
return
0
;
}
...
...
@@ -468,7 +468,7 @@ static int add_authenticated_listener (const char *mount, mount_proxy *mountinfo
ret
=
add_listener_to_source
(
source
,
client
);
avl_tree_unlock
(
global
.
source_tree
);
if
(
ret
==
0
)
DEBUG
0
(
"client authenticated, passed to source"
);
LOG_
DEBUG
(
"client authenticated, passed to source"
);
}
else
{
...
...
@@ -511,12 +511,12 @@ void auth_postprocess_source (auth_client *auth_user)
client
->
authenticated
=
1
;
if
(
strcmp
(
req
,
"/admin.cgi"
)
==
0
||
strncmp
(
"/admin/metadata"
,
req
,
15
)
==
0
)
{
DEBUG
2
(
"metadata request (%s, %s)"
,
req
,
mount
);
LOG_
DEBUG
(
"metadata request (%s, %s)"
,
req
,
mount
);
admin_handle_request
(
client
,
"/admin/metadata"
);
}
else
{
DEBUG
1
(
"on mountpoint %s"
,
mount
);
LOG_
DEBUG
(
"on mountpoint %s"
,
mount
);
source_startup
(
client
,
mount
,
0
);
}
}
...
...
@@ -544,13 +544,13 @@ void auth_add_listener (const char *mount, client_t *client)
if
(
mountinfo
->
auth
->
pending_count
>
100
)
{
config_release_config
();
WARN
0
(
"too many clients awaiting authentication"
);
LOG_
WARN
(
"too many clients awaiting authentication"
);
client_send_403
(
client
,
"busy, please try again later"
);
return
;
}
auth_user
=
auth_client_setup
(
mount
,
client
);
auth_user
->
process
=
auth_new_listener
;
INFO
0
(
"adding client for authentication"
);
LOG_
INFO
(
"adding client for authentication"
);
queue_auth_client
(
auth_user
,
mountinfo
);
config_release_config
();
}
...
...
@@ -594,12 +594,12 @@ static int get_authenticator (auth_t *auth, config_options_t *options)
{
if
(
auth
->
type
==
NULL
)
{
WARN
0
(
"no authentication type defined"
);
LOG_
WARN
(
"no authentication type defined"
);
return
-
1
;
}
do
{
DEBUG
1
(
"type is %s"
,
auth
->
type
);
LOG_
DEBUG
(
"type is %s"
,
auth
->
type
);
if
(
strcmp
(
auth
->
type
,
"url"
)
==
0
)
{
...
...
@@ -608,7 +608,7 @@ static int get_authenticator (auth_t *auth, config_options_t *options)
return
-
1
;
break
;
#else
ERROR
0
(
"Auth URL disabled"
);
LOG_
ERROR
(
"Auth URL disabled"
);
return
-
1
;
#endif
}
...
...
@@ -619,7 +619,7 @@ static int get_authenticator (auth_t *auth, config_options_t *options)
break
;
}
ERROR
1
(
"Unrecognised authenticator type:
\"
%s
\"
"
,
auth
->
type
);
LOG_
ERROR
(
"Unrecognised authenticator type:
\"
%s
\"
"
,
auth
->
type
);
return
-
1
;
}
while
(
0
);
...
...
@@ -668,7 +668,7 @@ auth_t *auth_get_authenticator (xmlNodePtr node)
}
else
if
(
xmlStrcmp
(
current
->
name
,
XMLSTR
(
"text"
))
!=
0
)
WARN
1
(
"unknown auth setting (%s)"
,
current
->
name
);
LOG_
WARN
(
"unknown auth setting (%s)"
,
current
->
name
);
}
auth
->
type
=
(
char
*
)
xmlGetProp
(
node
,
XMLSTR
(
"type"
));
if
(
get_authenticator
(
auth
,
options
)
<
0
)
...
...
@@ -709,7 +709,7 @@ int auth_stream_authenticate (client_t *client, const char *mount, mount_proxy *
auth_client
*
auth_user
=
auth_client_setup
(
mount
,
client
);
auth_user
->
process
=
stream_auth_callback
;
INFO
1
(
"request source auth for
\"
%s
\"
"
,
mount
);
LOG_
INFO
(
"request source auth for
\"
%s
\"
"
,
mount
);
queue_auth_client
(
auth_user
,
mountinfo
);
return
1
;
}
...
...
@@ -763,6 +763,6 @@ void auth_initialise (void)
void
auth_shutdown
(
void
)
{
INFO
0
(
"Auth shutdown"
);
LOG_
INFO
(
"Auth shutdown"
);
}
src/auth_htpasswd.c
View file @
7ae46647
...
...
@@ -115,7 +115,7 @@ static void htpasswd_recheckfile (htpasswd_auth_state *htpasswd)
return
;
if
(
stat
(
htpasswd
->
filename
,
&
file_stat
)
<
0
)
{
WARN
1
(
"failed to check status of %s"
,
htpasswd
->
filename
);
LOG_
WARN
(
"failed to check status of %s"
,
htpasswd
->
filename
);
/* Create a dummy users tree for things to use later */
thread_rwlock_wlock
(
&
htpasswd
->
file_rwlock
);
...
...
@@ -131,11 +131,11 @@ static void htpasswd_recheckfile (htpasswd_auth_state *htpasswd)
/* common case, no update to file */
return
;
}
INFO
1
(
"re-reading htpasswd file
\"
%s
\"
"
,
htpasswd
->
filename
);
LOG_
INFO
(
"re-reading htpasswd file
\"
%s
\"
"
,
htpasswd
->
filename
);
passwdfile
=
fopen
(
htpasswd
->
filename
,
"rb"
);
if
(
passwdfile
==
NULL
)
{
WARN
2
(
"Failed to open authentication database
\"
%s
\"
: %s"
,
LOG_
WARN
(
"Failed to open authentication database
\"
%s
\"
: %s"
,
htpasswd
->
filename
,
strerror
(
errno
));
return
;
}
...
...
@@ -155,7 +155,7 @@ static void htpasswd_recheckfile (htpasswd_auth_state *htpasswd)
sep
=
strrchr
(
line
,
':'
);
if
(
sep
==
NULL
)
{
WARN
2
(
"No separator on line %d (%s)"
,
num
,
htpasswd
->
filename
);
LOG_
WARN
(
"No separator on line %d (%s)"
,
num
,
htpasswd
->
filename
);
continue
;
}
entry
=
calloc
(
1
,
sizeof
(
htpasswd_user
));
...
...
@@ -189,7 +189,7 @@ static auth_result htpasswd_auth (auth_client *auth_user)
if
(
htpasswd
->
filename
==
NULL
)
{
ERROR
0
(
"No filename given in options for authenticator."
);
LOG_
ERROR
(
"No filename given in options for authenticator."
);
return
AUTH_FAILED
;
}
htpasswd_recheckfile
(
htpasswd
);
...
...
@@ -209,10 +209,10 @@ static auth_result htpasswd_auth (auth_client *auth_user)
return
AUTH_OK
;
}
free
(
hashed_pw
);
DEBUG
0
(
"incorrect password for client"
);
LOG_
DEBUG
(
"incorrect password for client"
);
return
AUTH_FAILED
;
}
DEBUG
1
(
"no such username: %s"
,
client
->
username
);
LOG_
DEBUG
(
"no such username: %s"
,
client
->
username
);
thread_rwlock_unlock
(
&
htpasswd
->
file_rwlock
);
return
AUTH_FAILED
;
}
...
...
@@ -240,10 +240,10 @@ int auth_get_htpasswd_auth (auth_t *authenticator, config_options_t *options)
}
if
(
state
->
filename
)
INFO
1
(
"Configured htpasswd authentication using password file
\"
%s
\"
"
,
LOG_
INFO
(
"Configured htpasswd authentication using password file
\"
%s
\"
"
,
state
->
filename
);
else
ERROR
0
(
"No filename given in options for authenticator."
);
LOG_
ERROR
(
"No filename given in options for authenticator."
);
authenticator
->
state
=
state
;
...
...
@@ -278,7 +278,7 @@ static auth_result htpasswd_adduser (auth_t *auth, const char *username, const c
if
(
passwdfile
==
NULL
)
{
thread_rwlock_unlock
(
&
state
->
file_rwlock
);
WARN
2
(
"Failed to open authentication database
\"
%s
\"
: %s"
,
LOG_
WARN
(
"Failed to open authentication database
\"
%s
\"
: %s"
,
state
->
filename
,
strerror
(
errno
));
return
AUTH_FAILED
;
}
...
...
@@ -312,7 +312,7 @@ static auth_result htpasswd_deleteuser(auth_t *auth, const char *username)
passwdfile
=
fopen
(
state
->
filename
,
"rb"
);
if
(
passwdfile
==
NULL
)
{
WARN
2
(
"Failed to open authentication database
\"
%s
\"
: %s"
,
LOG_
WARN
(
"Failed to open authentication database
\"
%s
\"
: %s"
,
state
->
filename
,
strerror
(
errno
));
thread_rwlock_unlock
(
&
state
->
file_rwlock
);
return
AUTH_FAILED
;
...
...
@@ -322,7 +322,7 @@ static auth_result htpasswd_deleteuser(auth_t *auth, const char *username)
snprintf
(
tmpfile
,
tmpfile_len
,
"%s.tmp"
,
state
->
filename
);
if
(
stat
(
tmpfile
,
&
file_info
)
==
0
)
{
WARN
1
(
"temp file
\"
%s
\"
exists, rejecting operation"
,
tmpfile
);
LOG_
WARN
(
"temp file
\"
%s
\"
exists, rejecting operation"
,
tmpfile
);
free
(
tmpfile
);
fclose
(
passwdfile
);
thread_rwlock_unlock
(
&
state
->
file_rwlock
);
...
...
@@ -332,7 +332,7 @@ static auth_result htpasswd_deleteuser(auth_t *auth, const char *username)
tmp_passwdfile
=
fopen
(
tmpfile
,
"wb"
);
if
(
tmp_passwdfile
==
NULL
)
{
WARN
2
(
"Failed to open temporary authentication database
\"
%s
\"
: %s"
,
LOG_
WARN
(
"Failed to open temporary authentication database
\"
%s
\"
: %s"
,
tmpfile
,
strerror
(
errno
));
fclose
(
passwdfile
);
free
(
tmpfile
);
...
...
@@ -347,7 +347,7 @@ static auth_result htpasswd_deleteuser(auth_t *auth, const char *username)
sep
=
strchr
(
line
,
':'
);
if
(
sep
==
NULL
)
{
DEBUG
0
(
"No separator in line"
);
LOG_
DEBUG
(
"No separator in line"
);
continue
;
}
...
...
@@ -367,12 +367,12 @@ static auth_result htpasswd_deleteuser(auth_t *auth, const char *username)
/* Windows won't let us rename a file if the destination file
exists...so, lets remove the original first */
if
(
remove
(
state
->
filename
)
!=
0
)
{
ERROR
3
(
"Problem moving temp authentication file to original
\"
%s
\"
-
\"
%s
\"
: %s"
,
LOG_
ERROR
(
"Problem moving temp authentication file to original
\"
%s
\"
-
\"
%s
\"
: %s"
,
tmpfile
,
state
->
filename
,
strerror
(
errno
));
}
else
{
if
(
rename
(
tmpfile
,
state
->
filename
)
!=
0
)
{
ERROR
3
(
"Problem moving temp authentication file to original
\"
%s
\"
-
\"
%s
\"
: %s"
,
LOG_
ERROR
(
"Problem moving temp authentication file to original
\"
%s
\"
-
\"
%s
\"
: %s"
,
tmpfile
,
state
->
filename
,
strerror
(
errno
));
}
}
...
...
src/auth_url.c
View file @
7ae46647
...
...
@@ -109,7 +109,7 @@ static void auth_url_clear(auth_t *self)
{
auth_url
*
url
;
INFO
0
(
"Doing auth URL cleanup"
);
LOG_
INFO
(
"Doing auth URL cleanup"
);
url
=
self
->
state
;
self
->
state
=
NULL
;
curl_easy_cleanup
(
url
->
handle
);
...
...
@@ -263,7 +263,7 @@ static auth_result url_remove_listener (auth_client *auth_user)
curl_easy_setopt
(
url
->
handle
,
CURLOPT_WRITEHEADER
,
auth_user
);
if
(
curl_easy_perform
(
url
->
handle
))
WARN
2
(
"auth to server %s failed with %s"
,
url
->
removeurl
,
url
->
errormsg
);
LOG_
WARN
(
"auth to server %s failed with %s"
,
url
->
removeurl
,
url
->
errormsg
);
free
(
userpwd
);
...
...
@@ -394,13 +394,13 @@ static auth_result url_add_listener (auth_client *auth_user)
if
(
res
)
{
WARN
2
(
"auth to server %s failed with %s"
,
url
->
addurl
,
url
->
errormsg
);
LOG_
WARN
(
"auth to server %s failed with %s"
,
url
->
addurl
,
url
->
errormsg
);
return
AUTH_FAILED
;
}
/* we received a response, lets see what it is */
if
(
client
->
authenticated
)
return
AUTH_OK
;