File Access Error
Brought to you by:
ipfrog
I'm running psyBNC on Win2k3 and set up the Web Interface. psyBNC needs to be running if i want to use the webui, but the WebUI produces the follwing error, because the psybnc.conf is already opened by the bnc itself. This occurs alltogether in every line where the file function trys to open the config file in index.php.
Warning: file(C:/***/***/***/psybnc.conf) [function.file]: failed to open stream: Permission denied in C:\USERS\gATP\psyBNC\webui\index.php on line 388
Logged In: NO
Hello i have the same Problem with 1.04 on Debian Linux 3.1. I have set psybnc.conf set to CHMOD 655 and when i run the index.php from my Webserver then the .conf Files becomes CHMOD 600. And then comes the error :(.
Wait for 1.05 with Bugfix :-)
Logged In: YES
user_id=1619240
Originator: YES
Hope this will be fixed soon
Logged In: YES
user_id=1708656
Originator: NO
I have a temporarily Fix for that!
You need to edit some BNC-files! I found it inside the elder BNCwi 1.03 - Version (psybnc Hacks)!!
You need to do this:
If they do not want to come in any risk, and you want to use the webinterface sudo/suphp and Apache runs as another user than psyBNC, following functions must be adapted.
I tested it and it worked BUT do it on your OWN risk!
Keep in Mind you have a backup of your psybnc.conf AND salt.h !!! If you deleted the salt.h you have to give all your users a new login-password!!
Prepare:
copy your psybnc-conf AND the salt.h into your psybnc-folder
make clean
then edit following Files:
p_inifunc.c - near line 81: (sorry, but this commentfield does not permit colors, so the "DIFF" is marked with a | before, so delete the | after paste :D)
nt flushconfig()
{
FILE *handle;
| char chmod[40];
struct stringarray *wconf;
pcontext;
oldfile(configfile);
handle=fopen(configfile,"w");
wconf=conf;
while(wconf)
{
if(wconf->entry!=NULL) {
if(strlen(wconf->entry)>1)
fprintf(handle,"%s\n",wconf->entry);
}
wconf=wconf->next;
}
fclose(handle);
| strcpy(chmod, "chmod 644 ");
| strcat(chmod, configfile);
| system(chmod);
return 0x0;
}
Then edit:
p_log.c - near line 30:
/* write to log */
int __log (char *what, int usern,int level) {
char tx [20];
| char chmod[40];
time_t tm;
time ( &tm );
strmncpy(tx,ctime( &tm ),sizeof(tx));
| strcpy(chmod, "chmod 644 ");
| strcat(chmod, logfile);
| system(chmod);
#ifndef NOLOG
if(mainlog==NULL)
mainlog = fopen(logfile,"a");
if(level>=LOGLEVEL && mainlog!=NULL)
{
fprintf(mainlog,lngtxt(563),tx,what);
fflush(mainlog);
}
if(usern==-1)
noticeall(RI_ADMIN,lngtxt(564),tx,what);
else
systemnotice(usern,lngtxt(565),tx,what);
#endif
return 0x0;
}
in the same file p_log.c - near line 100:
/* write to privatelog */
int privatelog ( int usern ) {
char tx [20];
char fname[40];
| char chmod[40];
char noact='\x01';
int uid;
FILE *log;
time_t tm;
pcontext;
#ifdef NOLOG
return 0x0;
#endif
if(strchr(irccontent,noact)!=NULL) return 0x0; /* dont log actions, ctcps */
if(strchr(ircfrom,'@')==NULL) return 0x0; /* dont log servermsgs/notices */
uid=usern;
if (user(uid)->parent !=0) uid=user(usern)->parent;
if (strlen(ircnick) == strlen(user(usern)->nick)) {
if (strstr(ircnick,user(usern)->nick)) return -1;
}
time ( &tm );
ap_snprintf(fname,sizeof(fname),lngtxt(573),uid);
strmncpy(tx, ctime( &tm ), sizeof(tx));
log = fopen(fname,"a");
if(log!=NULL)
{
fprintf(log,lngtxt(574),user(usern)->network,tx,ircfrom,irccontent);
fclose(log);
}
| strcpy(chmod, "chmod 644 ");
| strcat(chmod, fname);
| system(chmod);
return 0x0;
}
after editing and saving this Files do:
make
and kill the "old" bnc-process (if running)
and start ./psybnc
maybe you get a unimprotant hint like
"chmod: access to ,,log/psybnc.log" not possible: File or Folder not found.
You can ignore that, it still works, I dunno what this warning will tell us :D
Just look into /log/ if you alkready have a psybnc.log in chmod 644 then is everything ok :D
Logged In: YES
user_id=1619240
Originator: YES
This might work if psybncis running on linux.
But what about the Windows Version of psyBNC?
Logged In: NO
i have the same problem