Commit e9a90f99 authored by Philipp Schafft's avatar Philipp Schafft 🦁

Cleanup: converted tabs into spaces

parent 99d9be1d
...@@ -298,10 +298,10 @@ void admin_send_response (xmlDocPtr doc, client_t *client, ...@@ -298,10 +298,10 @@ void admin_send_response (xmlDocPtr doc, client_t *client,
client_set_queue(client, NULL); client_set_queue(client, NULL);
client->refbuf = refbuf_new(buf_len); client->refbuf = refbuf_new(buf_len);
ret = util_http_build_header(client->refbuf->data, buf_len, 0, ret = util_http_build_header(client->refbuf->data, buf_len, 0,
0, 200, NULL, 0, 200, NULL,
"text/xml", "utf-8", "text/xml", "utf-8",
NULL, NULL); NULL, NULL);
if (ret < 0) { if (ret < 0) {
ICECAST_LOG_ERROR("Dropping client as we can not build response headers."); ICECAST_LOG_ERROR("Dropping client as we can not build response headers.");
client_send_error(client, 500, 0, "Header generation failed."); client_send_error(client, 500, 0, "Header generation failed.");
...@@ -334,7 +334,7 @@ void admin_send_response (xmlDocPtr doc, client_t *client, ...@@ -334,7 +334,7 @@ void admin_send_response (xmlDocPtr doc, client_t *client,
} }
/* FIXME: in this section we hope no function will ever return -1 */ /* FIXME: in this section we hope no function will ever return -1 */
ret += snprintf (client->refbuf->data + ret, buf_len - ret, "Content-Length: %d\r\n\r\n%s", xmlStrlen(buff), buff); ret += snprintf (client->refbuf->data + ret, buf_len - ret, "Content-Length: %d\r\n\r\n%s", xmlStrlen(buff), buff);
client->refbuf->len = ret; client->refbuf->len = ret;
xmlFree(buff); xmlFree(buff);
...@@ -575,8 +575,8 @@ static void html_success(client_t *client, char *message) ...@@ -575,8 +575,8 @@ static void html_success(client_t *client, char *message)
ret = util_http_build_header(client->refbuf->data, PER_CLIENT_REFBUF_SIZE, 0, ret = util_http_build_header(client->refbuf->data, PER_CLIENT_REFBUF_SIZE, 0,
0, 200, NULL, 0, 200, NULL,
"text/html", "utf-8", "text/html", "utf-8",
"", NULL); "", NULL);
if (ret == -1 || ret >= PER_CLIENT_REFBUF_SIZE) { if (ret == -1 || ret >= PER_CLIENT_REFBUF_SIZE) {
ICECAST_LOG_ERROR("Dropping client as we can not build response headers."); ICECAST_LOG_ERROR("Dropping client as we can not build response headers.");
...@@ -748,8 +748,8 @@ static void command_buildm3u(client_t *client, const char *mount) ...@@ -748,8 +748,8 @@ static void command_buildm3u(client_t *client, const char *mount)
ret = util_http_build_header(client->refbuf->data, PER_CLIENT_REFBUF_SIZE, 0, ret = util_http_build_header(client->refbuf->data, PER_CLIENT_REFBUF_SIZE, 0,
0, 200, NULL, 0, 200, NULL,
"audio/x-mpegurl", NULL, "audio/x-mpegurl", NULL,
NULL, NULL); NULL, NULL);
if (ret == -1 || ret >= (PER_CLIENT_REFBUF_SIZE - 512)) { /* we want at least 512 Byte left for data */ if (ret == -1 || ret >= (PER_CLIENT_REFBUF_SIZE - 512)) { /* we want at least 512 Byte left for data */
ICECAST_LOG_ERROR("Dropping client as we can not build response headers."); ICECAST_LOG_ERROR("Dropping client as we can not build response headers.");
...@@ -1155,9 +1155,9 @@ static void command_list_mounts(client_t *client, int response) ...@@ -1155,9 +1155,9 @@ static void command_list_mounts(client_t *client, int response)
if (response == PLAINTEXT) if (response == PLAINTEXT)
{ {
ssize_t ret = util_http_build_header(client->refbuf->data, PER_CLIENT_REFBUF_SIZE, 0, ssize_t ret = util_http_build_header(client->refbuf->data, PER_CLIENT_REFBUF_SIZE, 0,
0, 200, NULL, 0, 200, NULL,
"text/plain", "utf-8", "text/plain", "utf-8",
"", NULL); "", NULL);
if (ret == -1 || ret >= PER_CLIENT_REFBUF_SIZE) { if (ret == -1 || ret >= PER_CLIENT_REFBUF_SIZE) {
ICECAST_LOG_ERROR("Dropping client as we can not build response headers."); ICECAST_LOG_ERROR("Dropping client as we can not build response headers.");
......
...@@ -334,12 +334,12 @@ static auth_result url_add_client (auth_client *auth_user) ...@@ -334,12 +334,12 @@ static auth_result url_add_client (auth_client *auth_user)
cur_header = pass_headers; cur_header = pass_headers;
while (cur_header) while (cur_header)
{ {
next_header = strstr (cur_header, ","); next_header = strstr (cur_header, ",");
if (next_header) if (next_header)
{ {
*next_header=0; *next_header=0;
next_header++; next_header++;
} }
header_val = httpp_getvar (client->parser, cur_header); header_val = httpp_getvar (client->parser, cur_header);
if (header_val) if (header_val)
...@@ -351,7 +351,7 @@ static auth_result url_add_client (auth_client *auth_user) ...@@ -351,7 +351,7 @@ static auth_result url_add_client (auth_client *auth_user)
free (header_valesc); free (header_valesc);
} }
cur_header = next_header; cur_header = next_header;
} }
} }
......
...@@ -1080,17 +1080,17 @@ static void _parse_mount(xmlDocPtr doc, xmlNodePtr node, ...@@ -1080,17 +1080,17 @@ static void _parse_mount(xmlDocPtr doc, xmlNodePtr node,
tmp = (char *)xmlGetProp(node, XMLSTR("type")); tmp = (char *)xmlGetProp(node, XMLSTR("type"));
if (tmp) { if (tmp) {
if (strcmp(tmp, "normal") == 0) { if (strcmp(tmp, "normal") == 0) {
mount->mounttype = MOUNT_TYPE_NORMAL; mount->mounttype = MOUNT_TYPE_NORMAL;
} }
else if (strcmp(tmp, "default") == 0) { else if (strcmp(tmp, "default") == 0) {
mount->mounttype = MOUNT_TYPE_DEFAULT; mount->mounttype = MOUNT_TYPE_DEFAULT;
} }
else { else {
ICECAST_LOG_WARN("Unknown mountpoint type: %s", tmp); ICECAST_LOG_WARN("Unknown mountpoint type: %s", tmp);
config_clear_mount (mount); config_clear_mount (mount);
return; return;
} }
xmlFree(tmp); xmlFree(tmp);
} }
node = node->xmlChildrenNode; node = node->xmlChildrenNode;
...@@ -1281,7 +1281,7 @@ static void _parse_mount(xmlDocPtr doc, xmlNodePtr node, ...@@ -1281,7 +1281,7 @@ static void _parse_mount(xmlDocPtr doc, xmlNodePtr node,
} }
else if (mount->mountname != NULL && mount->mounttype == MOUNT_TYPE_DEFAULT) else if (mount->mountname != NULL && mount->mounttype == MOUNT_TYPE_DEFAULT)
{ {
ICECAST_LOG_WARN("Default mount %s has mount-name set. This is not supported. Behavior may not be consistent.", mount->mountname); ICECAST_LOG_WARN("Default mount %s has mount-name set. This is not supported. Behavior may not be consistent.", mount->mountname);
} }
while (authstack) { while (authstack) {
...@@ -1364,9 +1364,9 @@ static void _parse_http_headers(xmlDocPtr doc, xmlNodePtr node, ice_config_http_ ...@@ -1364,9 +1364,9 @@ static void _parse_http_headers(xmlDocPtr doc, xmlNodePtr node, ice_config_http_
} while ((node = node->next)); } while ((node = node->next));
/* in case we used break we may need to clean those up */ /* in case we used break we may need to clean those up */
if (name) if (name)
xmlFree(name); xmlFree(name);
if (value) if (value)
xmlFree(value); xmlFree(value);
} }
static void _parse_relay(xmlDocPtr doc, xmlNodePtr node, static void _parse_relay(xmlDocPtr doc, xmlNodePtr node,
...@@ -1920,54 +1920,54 @@ static void merge_mounts(mount_proxy * dst, mount_proxy * src) { ...@@ -1920,54 +1920,54 @@ static void merge_mounts(mount_proxy * dst, mount_proxy * src) {
ice_config_http_header_t **http_header_tail; ice_config_http_header_t **http_header_tail;
if (!dst || !src) if (!dst || !src)
return; return;
if (!dst->dumpfile) if (!dst->dumpfile)
dst->dumpfile = (char*)xmlStrdup((xmlChar*)src->dumpfile); dst->dumpfile = (char*)xmlStrdup((xmlChar*)src->dumpfile);
if (!dst->intro_filename) if (!dst->intro_filename)
dst->intro_filename = (char*)xmlStrdup((xmlChar*)src->intro_filename); dst->intro_filename = (char*)xmlStrdup((xmlChar*)src->intro_filename);
if (!dst->fallback_when_full) if (!dst->fallback_when_full)
dst->fallback_when_full = src->fallback_when_full; dst->fallback_when_full = src->fallback_when_full;
if (dst->max_listeners == -1) if (dst->max_listeners == -1)
dst->max_listeners = src->max_listeners; dst->max_listeners = src->max_listeners;
if (!dst->fallback_mount) if (!dst->fallback_mount)
dst->fallback_mount = (char*)xmlStrdup((xmlChar*)src->fallback_mount); dst->fallback_mount = (char*)xmlStrdup((xmlChar*)src->fallback_mount);
if (!dst->fallback_override) if (!dst->fallback_override)
dst->fallback_override = src->fallback_override; dst->fallback_override = src->fallback_override;
if (!dst->no_mount) if (!dst->no_mount)
dst->no_mount = src->no_mount; dst->no_mount = src->no_mount;
if (dst->burst_size == -1) if (dst->burst_size == -1)
dst->burst_size = src->burst_size; dst->burst_size = src->burst_size;
if (!dst->queue_size_limit) if (!dst->queue_size_limit)
dst->queue_size_limit = src->queue_size_limit; dst->queue_size_limit = src->queue_size_limit;
if (!dst->hidden) if (!dst->hidden)
dst->hidden = src->hidden; dst->hidden = src->hidden;
if (!dst->source_timeout) if (!dst->source_timeout)
dst->source_timeout = src->source_timeout; dst->source_timeout = src->source_timeout;
if (!dst->charset) if (!dst->charset)
dst->charset = (char*)xmlStrdup((xmlChar*)src->charset); dst->charset = (char*)xmlStrdup((xmlChar*)src->charset);
if (dst->mp3_meta_interval == -1) if (dst->mp3_meta_interval == -1)
dst->mp3_meta_interval = src->mp3_meta_interval; dst->mp3_meta_interval = src->mp3_meta_interval;
if (!dst->cluster_password) if (!dst->cluster_password)
dst->cluster_password = (char*)xmlStrdup((xmlChar*)src->cluster_password); dst->cluster_password = (char*)xmlStrdup((xmlChar*)src->cluster_password);
if (!dst->max_listener_duration) if (!dst->max_listener_duration)
dst->max_listener_duration = src->max_listener_duration; dst->max_listener_duration = src->max_listener_duration;
if (!dst->stream_name) if (!dst->stream_name)
dst->stream_name = (char*)xmlStrdup((xmlChar*)src->stream_name); dst->stream_name = (char*)xmlStrdup((xmlChar*)src->stream_name);
if (!dst->stream_description) if (!dst->stream_description)
dst->stream_description = (char*)xmlStrdup((xmlChar*)src->stream_description); dst->stream_description = (char*)xmlStrdup((xmlChar*)src->stream_description);
if (!dst->stream_url) if (!dst->stream_url)
dst->stream_url = (char*)xmlStrdup((xmlChar*)src->stream_url); dst->stream_url = (char*)xmlStrdup((xmlChar*)src->stream_url);
if (!dst->stream_genre) if (!dst->stream_genre)
dst->stream_genre = (char*)xmlStrdup((xmlChar*)src->stream_genre); dst->stream_genre = (char*)xmlStrdup((xmlChar*)src->stream_genre);
if (!dst->bitrate) if (!dst->bitrate)
dst->bitrate = (char*)xmlStrdup((xmlChar*)src->bitrate); dst->bitrate = (char*)xmlStrdup((xmlChar*)src->bitrate);
if (!dst->type) if (!dst->type)
dst->type = (char*)xmlStrdup((xmlChar*)src->type); dst->type = (char*)xmlStrdup((xmlChar*)src->type);
if (!dst->subtype) if (!dst->subtype)
dst->subtype = (char*)xmlStrdup((xmlChar*)src->subtype); dst->subtype = (char*)xmlStrdup((xmlChar*)src->subtype);
if (dst->yp_public == -1) if (dst->yp_public == -1)
dst->yp_public = src->yp_public; dst->yp_public = src->yp_public;
if (dst->http_headers) { if (dst->http_headers) {
http_header_next = dst->http_headers; http_header_next = dst->http_headers;
...@@ -1985,12 +1985,12 @@ static inline void _merge_mounts_all(ice_config_t *c) { ...@@ -1985,12 +1985,12 @@ static inline void _merge_mounts_all(ice_config_t *c) {
for (; mountinfo; mountinfo = mountinfo->next) for (; mountinfo; mountinfo = mountinfo->next)
{ {
if (mountinfo->mounttype != MOUNT_TYPE_NORMAL) if (mountinfo->mounttype != MOUNT_TYPE_NORMAL)
continue; continue;
default_mount = config_find_mount(c, mountinfo->mountname, MOUNT_TYPE_DEFAULT); default_mount = config_find_mount(c, mountinfo->mountname, MOUNT_TYPE_DEFAULT);
merge_mounts(mountinfo, default_mount); merge_mounts(mountinfo, default_mount);
} }
} }
...@@ -2001,16 +2001,16 @@ mount_proxy *config_find_mount (ice_config_t *config, const char *mount, mount_t ...@@ -2001,16 +2001,16 @@ mount_proxy *config_find_mount (ice_config_t *config, const char *mount, mount_t
for (; mountinfo; mountinfo = mountinfo->next) for (; mountinfo; mountinfo = mountinfo->next)
{ {
if (mountinfo->mounttype != type) if (mountinfo->mounttype != type)
continue; continue;
if (!mount && !mountinfo->mountname) if (!mount && !mountinfo->mountname)
break; break;
if (mountinfo->mounttype == MOUNT_TYPE_NORMAL) { if (mountinfo->mounttype == MOUNT_TYPE_NORMAL) {
if (!mount || !mountinfo->mountname) if (!mount || !mountinfo->mountname)
continue; continue;
if (strcmp(mountinfo->mountname, mount) == 0) if (strcmp(mountinfo->mountname, mount) == 0)
break; break;
} else if (mountinfo->mounttype == MOUNT_TYPE_DEFAULT) { } else if (mountinfo->mounttype == MOUNT_TYPE_DEFAULT) {
if (!mountinfo->mountname) if (!mountinfo->mountname)
......
...@@ -852,20 +852,20 @@ int connection_complete_source (source_t *source, int response) ...@@ -852,20 +852,20 @@ int connection_complete_source (source_t *source, int response)
return -1; return -1;
} }
/* For PUT support we check for 100-continue and send back a 100 to stay in spec */ /* For PUT support we check for 100-continue and send back a 100 to stay in spec */
expectcontinue = httpp_getvar (source->parser, "expect"); expectcontinue = httpp_getvar (source->parser, "expect");
if (expectcontinue != NULL) if (expectcontinue != NULL)
{ {
#ifdef HAVE_STRCASESTR #ifdef HAVE_STRCASESTR
if (strcasestr (expectcontinue, "100-continue") != NULL) if (strcasestr (expectcontinue, "100-continue") != NULL)
#else #else
ICECAST_LOG_WARN("OS doesn't support case insenestive substring checks..."); ICECAST_LOG_WARN("OS doesn't support case insenestive substring checks...");
if (strstr (expectcontinue, "100-continue") != NULL) if (strstr (expectcontinue, "100-continue") != NULL)
#endif #endif
{ {
client_send_100 (source->client); client_send_100 (source->client);
} }
} }
global.sources++; global.sources++;
stats_event_args (NULL, "sources", "%d", global.sources); stats_event_args (NULL, "sources", "%d", global.sources);
......
...@@ -73,8 +73,8 @@ format_type_t format_get_type (const char *contenttype) ...@@ -73,8 +73,8 @@ format_type_t format_get_type (const char *contenttype)
else else
/* We default to the Generic format handler, which /* We default to the Generic format handler, which
can handle many more formats than just mp3. can handle many more formats than just mp3.
Let's warn that this is not well supported */ Let's warn that this is not well supported */
ICECAST_LOG_WARN("Unsupported or legacy stream type: \"%s\". Falling back to generic minimal handler for best effort.", contenttype); ICECAST_LOG_WARN("Unsupported or legacy stream type: \"%s\". Falling back to generic minimal handler for best effort.", contenttype);
return FORMAT_TYPE_GENERIC; return FORMAT_TYPE_GENERIC;
} }
...@@ -352,21 +352,21 @@ static int format_prepare_headers (source_t *source, client_t *client) ...@@ -352,21 +352,21 @@ static int format_prepare_headers (source_t *source, client_t *client)
if (strcasecmp(var->name, "ice-password") && if (strcasecmp(var->name, "ice-password") &&
strcasecmp(var->name, "icy-metaint")) strcasecmp(var->name, "icy-metaint"))
{ {
if (!strcasecmp(var->name, "ice-name")) if (!strcasecmp(var->name, "ice-name"))
{ {
ice_config_t *config; ice_config_t *config;
mount_proxy *mountinfo; mount_proxy *mountinfo;
config = config_get_config(); config = config_get_config();
mountinfo = config_find_mount (config, source->mount, MOUNT_TYPE_NORMAL); mountinfo = config_find_mount (config, source->mount, MOUNT_TYPE_NORMAL);
if (mountinfo && mountinfo->stream_name) if (mountinfo && mountinfo->stream_name)
bytes = snprintf (ptr, remaining, "icy-name:%s\r\n", mountinfo->stream_name); bytes = snprintf (ptr, remaining, "icy-name:%s\r\n", mountinfo->stream_name);
else else
bytes = snprintf (ptr, remaining, "icy-name:%s\r\n", var->value); bytes = snprintf (ptr, remaining, "icy-name:%s\r\n", var->value);
config_release_config(); config_release_config();
} }
else if (!strncasecmp("ice-", var->name, 4)) else if (!strncasecmp("ice-", var->name, 4))
{ {
if (!strcasecmp("ice-public", var->name)) if (!strcasecmp("ice-public", var->name))
......
...@@ -613,7 +613,7 @@ static refbuf_t *mp3_get_filter_meta(source_t *source) ...@@ -613,7 +613,7 @@ static refbuf_t *mp3_get_filter_meta(source_t *source)
memcpy (meta->data, source_mp3->build_metadata, memcpy (meta->data, source_mp3->build_metadata,
source_mp3->build_metadata_len); source_mp3->build_metadata_len);
ICECAST_LOG_DEBUG("shoutcast metadata %.*s", 4080, meta->data+1); ICECAST_LOG_DEBUG("shoutcast metadata %.*s", 4080, meta->data+1);
if (strncmp (meta->data+1, "StreamTitle=", 12) == 0) if (strncmp (meta->data+1, "StreamTitle=", 12) == 0)
{ {
filter_shoutcast_metadata (source, source_mp3->build_metadata, filter_shoutcast_metadata (source, source_mp3->build_metadata,
......
...@@ -461,8 +461,8 @@ int fserve_client_create (client_t *httpclient, const char *path) ...@@ -461,8 +461,8 @@ int fserve_client_create (client_t *httpclient, const char *path)
*dot = 0; *dot = 0;
httpclient->respcode = 200; httpclient->respcode = 200;
ret = util_http_build_header (httpclient->refbuf->data, BUFSIZE, 0, ret = util_http_build_header (httpclient->refbuf->data, BUFSIZE, 0,
0, 200, NULL, 0, 200, NULL,
"audio/x-mpegurl", NULL, "", NULL); "audio/x-mpegurl", NULL, "", NULL);
if (ret == -1 || ret >= (BUFSIZE - 512)) { /* we want at least 512 bytes left for the content of the playlist */ if (ret == -1 || ret >= (BUFSIZE - 512)) { /* we want at least 512 bytes left for the content of the playlist */
ICECAST_LOG_ERROR("Dropping client as we can not build response headers."); ICECAST_LOG_ERROR("Dropping client as we can not build response headers.");
client_send_error(httpclient, 500, 0, "Header generation failed."); client_send_error(httpclient, 500, 0, "Header generation failed.");
...@@ -470,7 +470,7 @@ int fserve_client_create (client_t *httpclient, const char *path) ...@@ -470,7 +470,7 @@ int fserve_client_create (client_t *httpclient, const char *path)
} }
if (host == NULL) if (host == NULL)
{ {
config = config_get_config(); config = config_get_config();
snprintf (httpclient->refbuf->data + ret, BUFSIZE - ret, snprintf (httpclient->refbuf->data + ret, BUFSIZE - ret,
"http://%s:%d%s\r\n", "http://%s:%d%s\r\n",
config->hostname, config->port, config->hostname, config->port,
...@@ -480,7 +480,7 @@ int fserve_client_create (client_t *httpclient, const char *path) ...@@ -480,7 +480,7 @@ int fserve_client_create (client_t *httpclient, const char *path)
} }
else else
{ {
snprintf (httpclient->refbuf->data + ret, BUFSIZE - ret, snprintf (httpclient->refbuf->data + ret, BUFSIZE - ret,
"http://%s%s\r\n", "http://%s%s\r\n",
host, host,
sourceuri sourceuri
...@@ -573,10 +573,10 @@ int fserve_client_create (client_t *httpclient, const char *path) ...@@ -573,10 +573,10 @@ int fserve_client_create (client_t *httpclient, const char *path)
} }
httpclient->respcode = 206; httpclient->respcode = 206;
type = fserve_content_type (path); type = fserve_content_type (path);
bytes = util_http_build_header (httpclient->refbuf->data, BUFSIZE, 0, bytes = util_http_build_header (httpclient->refbuf->data, BUFSIZE, 0,
0, 206, NULL, 0, 206, NULL,
type, NULL, type, NULL,
NULL, NULL); NULL, NULL);
if (bytes == -1 || bytes >= (BUFSIZE - 512)) { /* we want at least 512 bytes left */ if (bytes == -1 || bytes >= (BUFSIZE - 512)) { /* we want at least 512 bytes left */
ICECAST_LOG_ERROR("Dropping client as we can not build response headers."); ICECAST_LOG_ERROR("Dropping client as we can not build response headers.");
client_send_error(httpclient, 500, 0, "Header generation failed."); client_send_error(httpclient, 500, 0, "Header generation failed.");
...@@ -604,10 +604,10 @@ int fserve_client_create (client_t *httpclient, const char *path) ...@@ -604,10 +604,10 @@ int fserve_client_create (client_t *httpclient, const char *path)
else { else {
char *type = fserve_content_type(path); char *type = fserve_content_type(path);
httpclient->respcode = 200; httpclient->respcode = 200;
bytes = util_http_build_header (httpclient->refbuf->data, BUFSIZE, 0, bytes = util_http_build_header (httpclient->refbuf->data, BUFSIZE, 0,
0, 200, NULL, 0, 200, NULL,
type, NULL, type, NULL,
NULL, NULL); NULL, NULL);
if (bytes == -1 || bytes >= (BUFSIZE - 512)) { /* we want at least 512 bytes left */ if (bytes == -1 || bytes >= (BUFSIZE - 512)) { /* we want at least 512 bytes left */
ICECAST_LOG_ERROR("Dropping client as we can not build response headers."); ICECAST_LOG_ERROR("Dropping client as we can not build response headers.");
client_send_error(httpclient, 500, 0, "Header generation failed."); client_send_error(httpclient, 500, 0, "Header generation failed.");
......
...@@ -427,7 +427,7 @@ static void _ch_root_uid_setup(void) ...@@ -427,7 +427,7 @@ static void _ch_root_uid_setup(void)
} }
if(!initgroups(conf->user, gid)) if(!initgroups(conf->user, gid))
fprintf(stdout, "Changed supplementary groups based on user: %s.\n", conf->user); fprintf(stdout, "Changed supplementary groups based on user: %s.\n", conf->user);
else else
fprintf(stdout, "Error changing supplementary groups: %s.\n", strerror(errno)); fprintf(stdout, "Error changing supplementary groups: %s.\n", strerror(errno));
#ifdef HAVE_SETRESUID #ifdef HAVE_SETRESUID
if(!setresuid(uid, uid, uid)) { if(!setresuid(uid, uid, uid)) {
......
...@@ -52,13 +52,13 @@ static void byteReverse(unsigned char *buf, unsigned longs) ...@@ -52,13 +52,13 @@ static void byteReverse(unsigned char *buf, unsigned longs)
{ {
uint32_t t; uint32_t t;
do do
{ {
t = (uint32_t) ((unsigned) buf[3] << 8 | buf[2]) << 16 | t = (uint32_t) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
((unsigned) buf[1] << 8 | buf[0]); ((unsigned) buf[1] << 8 | buf[0]);
*(uint32_t *) buf = t; *(uint32_t *) buf = t;
buf += 4; buf += 4;
} }
while (--longs); while (--longs);
} }
/* /*
...@@ -89,40 +89,40 @@ void MD5Update(struct MD5Context *ctx, unsigned char const *buf, ...@@ -89,40 +89,40 @@ void MD5Update(struct MD5Context *ctx, unsigned char const *buf,
t = ctx->bits[0]; t = ctx->bits[0];
if ((ctx->bits[0] = t + ((uint32_t) len << 3)) < t) if ((ctx->bits[0] = t + ((uint32_t) len << 3)) < t)
ctx->bits[1]++; ctx->bits[1]++;
/* Carry from low to high */ /* Carry from low to high */
ctx->bits[1] += len >> 29; ctx->bits[1] += len >> 29;
t = (t >> 3) & 0x3f; t = (t >> 3) & 0x3f;
/* Bytes already in shsInfo->data */ /* Bytes already in shsInfo->data */
/* Handle any leading odd-sized chunks */ /* Handle any leading odd-sized chunks */
if (t) if (t)
{ {
unsigned char *p = (unsigned char *) ctx->in + t; unsigned char *p = (unsigned char *) ctx->in + t;
t = 64 - t; t = 64 - t;
if (len < t) if (len < t)
{ {
memcpy(p, buf, len); memcpy(p, buf, len);
return; return;
} }
memcpy(p, buf, t); memcpy(p, buf, t);
byteReverse(ctx->in, HASH_LEN); byteReverse(ctx->in, HASH_LEN);
MD5Transform(ctx->buf, (uint32_t *) ctx->in); MD5Transform(ctx->buf, (uint32_t *) ctx->in);
buf += t; buf += t;
len -= t; len -= t;
} }
/* Process data in 64-byte chunks */ /* Process data in 64-byte chunks */
while (len >= 64) while (len >= 64)
{ {
memcpy(ctx->in, buf, 64); memcpy(ctx->in, buf, 64);
byteReverse(ctx->in, HASH_LEN); byteReverse(ctx->in, HASH_LEN);
MD5Transform(ctx->buf, (uint32_t *) ctx->in); MD5Transform(ctx->buf, (uint32_t *) ctx->in);
buf += 64; buf += 64;
len -= 64; len -= 64;
} }
/* Handle any remaining bytes of data. */