1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-09 20:13:13 +02:00

- Modified 404 numeric a bit (#0001515).

- Fixed 'no server notice on /restart or /die', reported by Lx (#0001062). This was caused
  by a bug in flush_connections(&me), hopefully there won't be any side effects.
- Fixed file owner problems when IRC_UID/IRC_GID is used (eg: when running chrooted).
- Fixed crashbug if we were unable to write a remote include file to disk.
This commit is contained in:
Bram Matthys
2004-02-04 23:11:02 +00:00
parent 425a4e57ee
commit d7967cc004
5 changed files with 42 additions and 8 deletions
+5 -1
View File
@@ -2794,4 +2794,8 @@ seen. gmtime warning still there
- Fixed invalid nameserver info when chrooted (nameserver was always localhost).
- Fixed a remote include bug involving cached files. Thanks to chatsphere.net for helping to
track this down!
- Modified 404 numeric a bit (#0001515).
- Fixed 'no server notice on /restart or /die', reported by Lx (#0001062). This was caused
by a bug in flush_connections(&me), hopefully there won't be any side effects.
- Fixed file owner problems when IRC_UID/IRC_GID is used (eg: when running chrooted).
- Fixed crashbug if we were unable to write a remote include file to disk.
+3 -3
View File
@@ -418,7 +418,7 @@ DLLFUNC int m_message(aClient *cptr, aClient *sptr, int parc, char *parv[], int
{
if (!notice)
sendto_one(sptr, err_str(ERR_CANNOTSENDTOCHAN),
me.name, parv[0], parv[0],
me.name, parv[0], chptr->chname,
err_cantsend[6], p2);
continue;
}
@@ -430,7 +430,7 @@ DLLFUNC int m_message(aClient *cptr, aClient *sptr, int parc, char *parv[], int
{
if (!notice)
sendto_one(sptr, err_str(ERR_CANNOTSENDTOCHAN),
me.name, parv[0], parv[0],
me.name, parv[0], chptr->chname,
err_cantsend[6], p2);
continue;
}
@@ -487,7 +487,7 @@ DLLFUNC int m_message(aClient *cptr, aClient *sptr, int parc, char *parv[], int
{
if (!notice || (cansend == 8)) /* privmsg or 'cannot send notice'... */
sendto_one(sptr, err_str(ERR_CANNOTSENDTOCHAN),
me.name, parv[0], parv[0],
me.name, parv[0], chptr->chname,
err_cantsend[cansend - 1], p2);
}
continue;
+2 -2
View File
@@ -120,8 +120,8 @@ void flush_connections(aClient* cptr)
{
for (i = LastSlot; i >= 0; i--)
if ((acptr = local[i]) && !(acptr->flags & FLAGS_BLOCKED)
&& DBufLength(&cptr->sendQ) > 0)
send_queued(cptr);
&& DBufLength(&acptr->sendQ) > 0)
send_queued(acptr);
}
else if (cptr->fd >= 0 && !(cptr->flags & FLAGS_BLOCKED)
&& DBufLength(&cptr->sendQ) > 0)
+4
View File
@@ -1770,6 +1770,10 @@ int unreal_copyfile(char *src, char *dest)
close(srcfd);
close(destfd);
#if defined(IRC_UID) && defined(IRC_GID)
if (!loop.ircd_booted)
chown(dest, IRC_UID, IRC_GID);
#endif
return 1;
fail:
close(srcfd);
+28 -2
View File
@@ -145,6 +145,14 @@ char *download_file(char *url, char **error)
if (curl)
{
FILE *fd = fopen(tmp, "wb");
if (!fd)
{
snprintf(errorbuf, CURL_ERROR_SIZE, "Cannot write to %s: %s", tmp, strerror(ERRNO));
if (file)
free(file);
*error = errorbuf;
return NULL;
}
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fd);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, do_download);
@@ -156,6 +164,10 @@ char *download_file(char *url, char **error)
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errorbuf);
res = curl_easy_perform(curl);
fclose(fd);
#if defined(IRC_UID) && defined(IRC_GID)
if (!loop.ircd_booted)
chown(tmp, IRC_UID, IRC_GID);
#endif
}
if (file)
free(file);
@@ -195,14 +207,24 @@ void url_init(void)
*/
void download_file_async(char *url, time_t cachetime, vFP callback)
{
static char errorbuf[CURL_ERROR_SIZE];
CURL *curl = curl_easy_init();
if (curl)
{
char *file = url_getfilename(url);
char *file = url_getfilename(url);
char *filename = unreal_getfilename(file);
char *tmp = unreal_mktemp("tmp", filename ? filename : "download.conf");
char *tmp = unreal_mktemp("tmp", filename ? filename : "download.conf");
FileHandle *handle = malloc(sizeof(FileHandle));
handle->fd = fopen(tmp, "wb");
if (!handle->fd)
{
snprintf(errorbuf, sizeof(errorbuf), "Cannot create '%s': %s", tmp, strerror(ERRNO));
callback(url, NULL, errorbuf, 0);
if (file)
MyFree(file);
MyFree(handle);
return;
}
handle->callback = callback;
handle->cachetime = cachetime;
strcpy(handle->filename, tmp);
@@ -280,6 +302,10 @@ void url_do_transfers_async(void)
curl_easy_getinfo(msg->easy_handle, CURLINFO_EFFECTIVE_URL, &url);
curl_easy_getinfo(msg->easy_handle, CURLINFO_FILETIME, &last_mod);
fclose(handle->fd);
#if defined(IRC_UID) && defined(IRC_GID)
if (!loop.ircd_booted)
chown(handle->filename, IRC_UID, IRC_GID);
#endif
if (msg->data.result == CURLE_OK)
{
if (code == 304 || (last_mod != -1 && last_mod < handle->cachetime))