[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Linphone-developers] /dev/null permission problems
From: |
Guillaume Beraudo |
Subject: |
Re: [Linphone-developers] /dev/null permission problems |
Date: |
Tue, 22 Jan 2013 18:12:22 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Hi,
Thank you for your patch.
It is now integrated on master.
Cheers,
Guillaume
On Tue, Jan 15, 2013 at 05:38:59PM +0000, Ed Holland wrote:
> Hi All,
>
> I ran into some odd issues while using linphonecsh that had me stumped
> for a good while. Namely /dev/null was having its permissions changed to
> 600 rather than the correct 666. After some investigations I determined
> that this was due to linphonecsh calling linphonec with /dev/null as its
> config file. This caused issue when running as root as linphonec ensures
> that its config files are not group or world writeable. I have included
> a patch which checks if the config file is a regular file before
> attempting to modify the permissions. I hope that this patch is an
> acceptable fix for this problem. The new code compiles correctly.
>
> Yours
>
> Ed Holland
> diff --git a/coreapi/lpconfig.c b/coreapi/lpconfig.c
> index bd2adfb..b0438fb 100644
> --- a/coreapi/lpconfig.c
> +++ b/coreapi/lpconfig.c
> @@ -215,14 +215,17 @@ LpConfig * lp_config_new(const char *filename){
> lpconfig->filename=ortp_strdup(filename);
> lpconfig->file=fopen(filename,"rw");
> if (lpconfig->file!=NULL){
> - lp_config_parse(lpconfig,lpconfig->file);
> - fclose(lpconfig->file);
> + struct stat fileStat;
> + lp_config_parse(lpconfig,lpconfig->file);
> + fclose(lpconfig->file);
> #if !defined(_WIN32_WCE)
> - /* make existing configuration files
> non-group/world-accessible */
> - if (chmod(filename, S_IRUSR | S_IWUSR) == -1)
> - ms_warning("unable to correct permissions on "
> - "configuration file: %s",
> - strerror(errno));
> + if ((stat(filename,&fileStat) == 0) &&
> (S_ISREG(fileStat.st_mode))) {
> + /* make existing configuration files
> non-group/world-accessible */
> + if (chmod(filename, S_IRUSR | S_IWUSR) == -1)
> + ms_warning("unable to correct permissions on "
> + "configuration file: %s",
> + strerror(errno));
> + }
> #endif /*_WIN32_WCE*/
> lpconfig->file=NULL;
> lpconfig->modified=0;
> _______________________________________________
> Linphone-developers mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/linphone-developers