Demo Discussion
Forum Config Examples Contributions Vulnerabilities
  Discussion forum about ELOG, Page 722 of 796  Not logged in ELOG logo
ID Date Icon Author Author Emailup Category OS ELOG Version Subject
  1664   Wed Feb 8 18:19:02 2006 Reply Steve Jonessteve.jones@freescale.comQuestionOther2.6.1Re: compiling elog 2.6.1 on solaris platform

Stefan Ritt wrote:

Steve Jones wrote:
I have checked and can find no reference within Sun documents regarding the support of the forkpty() function. I have not been following elog development lately -- what is shell substitution supposed to buy us?


See the config manual and look for $shell



Steve Jones wrote:
Yep, I saw it. Thanks
  1665   Wed Feb 8 18:23:52 2006 Question Steve Jonessteve.jones@freescale.comQuestionAll2.6.1Work on PAM Support?
Stefan (or any others):

Has anyone been seriously looking into building in PAM support in eLog? I ask because I have started reading the developer papers from Sun and looking at sample code.

Thanks

Steve
  1666   Wed Feb 8 18:34:43 2006 Reply Steve Jonessteve.jones@freescale.comQuestionOther2.6.1Re: compiling elog 2.6.1 on solaris platform

Steve Jones wrote:

Stefan Ritt wrote:

Steve Jones wrote:
I have checked and can find no reference within Sun documents regarding the support of the forkpty() function. I have not been following elog development lately -- what is shell substitution supposed to buy us?


See the config manual and look for $shell



Steve Jones wrote:
Yep, I saw it. Thanks



Steve Jones wrote:

Stefan, I found the following "forkpty()" replacement for running under Solaris. The URL is http://www.developerweb.net/forum/showthread.php?t=2990.

Perhaps this can be used unless someone comes up with a Solaris "util" library.


#ifdef SOLARIS /* Use the code in my_forkpty.c */
int my_forkpty (int *amaster, char *name, void *unused1, void *unused2);
#define forkpty my_forkpty
#endif
-----------------------
my_forkpty.c
-----------------------
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/stream.h>
#include <sys/stropts.h>

/* fork_pty() remplacement for Solaris.
* This ignore the last two arguments
* for the moment
*/
int
my_forkpty (int *amaster,
char *name,
void *unused1,
void *unused2)
{
int master, slave;
char *slave_name;
pid_t pid;

master = open("/dev/ptmx", O_RDWR);
if (master &lt; 0)
return -1;

if (grantpt (master) &lt; 0)
{
close (master);
return -1;
}

if (unlockpt (master) &lt; 0)
{
close (master);
return -1;
}

slave_name = ptsname (master);
if (slave_name == NULL)
{
close (master);
return -1;
}

slave = open (slave_name, O_RDWR);
if (slave &lt; 0)
{
close (master);
return -1;
}

if (ioctl (slave, I_PUSH, "ptem") &lt; 0
|| ioctl (slave, I_PUSH, "ldterm") &lt; 0)
{
close (slave);
close (master);
return -1;
}

if (amaster)
*amaster = master;

if (name)
strcpy (name, slave_name);

pid = fork ();
switch (pid)
{
case -1: /* Error */
return -1;
case 0: /* Child */
close (master);
dup2 (slave, STDIN_FILENO);
dup2 (slave, STDOUT_FILENO);
dup2 (slave, STDERR_FILENO);
return 0;
default: /* Parent */
close (slave);
return pid;
}

return -1;
}
  1673   Thu Feb 9 19:51:26 2006 Reply Steve Jonessteve.jones@freescale.comQuestionAll2.6.1Re: Work on PAM Support?

Stefan Ritt wrote:

Steve Jones wrote:
Has anyone been seriously looking into building in PAM support in eLog? I ask because I have started reading the developer papers from Sun and looking at sample code.


Not really. I have two big issues higher on my list: XML database format and multithreaded HTTP server. From having a quick look to PAM, I was not sure how easy this would be to implement. If it's not too difficult, it could move higher in the priority list.



Tell you what, I'm looking at two items related to eLog -- tell me to stop if you want:

  • forkpty() emulation for Solaris
  • PAM support

I'm furthur ahead on the forkpty() - just trying to figure out exactly where to place the code. Once I know it works then I can give it to you to incorporate. Unless you want what I have now and you can work on it.

I've also got quite a bit of reference code for PAM support. A little more daunting.
  1678   Fri Feb 10 17:22:36 2006 Reply Steve Jonessteve.jones@freescale.comQuestionOther2.6.1Re: compiling elog 2.6.1 on solaris platform

Stefan Ritt wrote:

Steve Jones wrote:
Stefan, I found the following "forkpty()" replacement for running under Solaris.


Ok, I put your code into the current SVN revision (1656). Unfortunately I cannot try it due to the lack of a Sun. Maybe you can try and tell me if it's working.

- Stefan



Steve Jones wrote:

Actually, what I will be delivering is a new Makefile with conditional compile statements plus the C code module since the example that I provided need some cleaning. Since I don't have a Linux system on which to test the conditional compile completely I would need you to do that. Sound ok?
  1680   Fri Feb 10 20:24:56 2006 Reply Steve Jonessteve.jones@freescale.comQuestionOther2.6.1Re: compiling elog 2.6.1 on solaris platform

Stefan Ritt wrote:

Steve Jones wrote:
Actually, what I will be delivering is a new Makefile with conditional compile statements plus the C code module since the example that I provided need some cleaning. Since I don't have a Linux system on which to test the conditional compile completely I would need you to do that. Sound ok?


Sure. I put already the conditional compiling into the current Makefile, so just try it. I tested the Linux part, which is ok. If you could test the Solaris part, that would be great.


Ok, I see what you did. I took a different route since I was not sure how the gnu linker would handle the fact that there would be two declarations of the forkpty() function when compiled and linked under Linux. Instead, I created a separate forkpty.c module and compiled it separately. Then, if "solaris", link it in. Otherwise, use library "util" which already has forkpty().

So, since it seems to work under Linux, any idea which function is being used?
  1684   Fri Feb 10 21:52:35 2006 Reply Steve Jonessteve.jones@freescale.comQuestionOther2.6.1Re: compiling elog 2.6.1 on solaris platform

Stefan Ritt wrote:

Steve Jones wrote:
Ok, I see what you did. I took a different route since I was not sure how the gnu linker would handle the fact that there would be two declarations of the forkpty() function when compiled and linked under Linux. Instead, I created a separate forkpty.c module and compiled it separately. Then, if "solaris", link it in. Otherwise, use library "util" which already has forkpty().

So, since it seems to work under Linux, any idea which function is being used?


No, there are no two forkpty() function, due to the
#ifdef OS_SOLARIS

  forkpty(...)
  {
    ...
  }

#endif

conditional compiling. So if I compile under Linux, the variable OS_SOLARIS is not defined, and therefore the special forkpty does not get compiled. Instead the one from the library is taken, since under Linux I use the -libutil switch. Under Solaris, there is no -libutil, but the OS_SOLARIS gets set, and therefore we have the code right inside elogd.c


Steve Jones wrote:

Got it. Much easier than how I was going about it.

  1685   Fri Feb 10 22:31:38 2006 Reply Steve Jonessteve.jones@freescale.comQuestionOther2.6.1Re: compiling elog 2.6.1 on solaris platform

Steve Jones wrote:

Stefan Ritt wrote:

Steve Jones wrote:
Ok, I see what you did. I took a different route since I was not sure how the gnu linker would handle the fact that there would be two declarations of the forkpty() function when compiled and linked under Linux. Instead, I created a separate forkpty.c module and compiled it separately. Then, if "solaris", link it in. Otherwise, use library "util" which already has forkpty().

So, since it seems to work under Linux, any idea which function is being used?


No, there are no two forkpty() function, due to the
#ifdef OS_SOLARIS

  forkpty(...)
  {
    ...
  }

#endif

conditional compiling. So if I compile under Linux, the variable OS_SOLARIS is not defined, and therefore the special forkpty does not get compiled. Instead the one from the library is taken, since under Linux I use the -libutil switch. Under Solaris, there is no -libutil, but the OS_SOLARIS gets set, and therefore we have the code right inside elogd.c


Steve Jones wrote:

Got it. Much easier than how I was going about it.



BTW, Stefan, this code in Makefile does not work on Solaris
OSTYPE = $(shell uname)
.
.
.
ifeq ($(OSTYPE),solaris)
At least, not on our solaris systems. 'uname' returns SunOS. When I run 'make -P' or 'gmake -P' the environment variable 'OSTYPE' is already set to 'solaris'. This is the reason the original Makefile did not work on our solaris systems. I'm not sure if this is universal but it applies to the systems we run (Solaris 8 and 9).
ELOG V3.1.5-fe60aaf