Re: No work on distributed HOME-directories

Gerd Heide (gerd.heide@hrz.tu-chemnitz.de)
Mon, 2 Aug 1999 15:23:50 +0200 (MEST)



Hi,

thanks for the answers. I have writed lines to create and testing a
socket directory "/tmp/afterstep-{uid}". I hope, it's allright. It works
on my computer.

In src/afterstep/module.c I have

1. substituted the lines

  tmp = safemalloc(strlen(AFTER_NONCF) + 9 + strlen(display_string) + 1);
  sprintf(tmp, "%s/connect.%s", AFTER_NONCF, display_string);

with

char* socket_dir;
struct passwd *pw;
struct stat st;
int rc;


/* Check or create socketdirectory */

pw = getpwuid(getuid());
socket_dir = safemalloc(14 + strlen(pw->pw_name) + 1);
sprintf(socket_dir, "/tmp/afterstep-%s", pw->pw_name);

rc=stat(socket_dir, &st);
if (rc == -1 && errno != ENOENT)
{
  perror("stat");
  exit(0);
}
if (rc == -1 && errno == ENOENT)
{
 mkdir(socket_dir, S_IRWXU);
 rc=stat(socket_dir, &st);
 if ( rc != 0 )
  {
  perror("mkdir");
  exit(0);
  }
}
/* Check for directory */

/* rc is 0 ! */
if ( ! S_ISDIR(st.st_mode) )
{
fprintf(stderr, "\'%s\' exists and isn\'t a directory\n", socket_dir);
exit(0);
}

/* Check the owner and permissions */
if ( pw->pw_uid != st.st_uid ||
   (st.st_mode & 077) != 0)
{
  fprintf(stderr, "Bad modes or owner for directory \'%s\'\n",
  socket_dir);
exit(0);
}

/* socket */
  tmp = safemalloc(strlen(socket_dir) + 1 + 9 + strlen(display_string) + 1);
  sprintf(tmp, "%s/connect.%s", socket_dir, display_string);
  free(socket_dir);

2. inserted the Bheaderfiles:

#include <sys/stat.h>
#include <unistd.h>
#include <pwd.h>



Gerd



On Thu, 22 Jul 1999, Ethan wrote:

> 
> On Thu, 22 Jul 1999, Gerd Heide wrote:
> 
> > we have a problem with AfterStep, version 1.7.90, and HOME-directories.
> > 
> > Now AfterStep creates sockets in HOME-directories. This is very bad!
> > Often HOME-directories are realised on "distributed filesystems" using NFS
> > or AFS, e.g.
> 
> Ouch.  The inherited pipes we used before were switched to UNIX domain 
> named sockets to allow modules to be run by a program other than AfterStep 
> (eg, a shell).  However, this would certainly cause problems under your 
> circumstances.
> 
> > What is the solution? Can we put the sockets to a local filesystem
> > ( /tmp,...) ?
> 
> Using a local filesystem would probably be the best solution.  To change 
> the directory AfterStep uses for the socket, change the following line 
> in src/afterstep/module.c (should be around line 74):
> 
> sprintf(tmp, "%s/connect.%s", AFTER_NONCF, display_string);
> 
> Change AFTER_NONCONF to whatever you like, such as "/tmp":
> 
> sprintf(tmp, "%s/connect.%s", "/tmp", display_string);
> 
> That should do the trick.  The modules read an X property set by 
> AfterStep, so they shouldn't require any changes.
> 
> ----
> Ethan Fischer
> allanon@crystaltokyo.com
> http://members.xoom.com/allanon1
> 
> 
> --
>    WWW:   http://www.afterstep.org/
>    FTP:   ftp://ftp.afterstep.org/
>    MAIL:  http://www.calderasystems.com/linuxcenter/forums/afterstep.html
> 
> 

*******************************************************************************
Gerd Heide, TU Chemnitz, | Phone: +049 (0)371 5311525  Fax: +049 (0)371 5311629 
 URZ, D-09107 Chemnitz   | E-mail: gerd.heide@hrz.tu-chemnitz.de
*******************************************************************************


--
   WWW:   http://www.afterstep.org/
   FTP:   ftp://ftp.afterstep.org/
   MAIL:  http://www.calderasystems.com/linuxcenter/forums/afterstep.html