summaryrefslogtreecommitdiffstats
path: root/gnu/libexec/uucp/libunix/unknwn.c
blob: 76f53459475e7fe77d2c3c596b4cb46fbce08708 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* unknwn.c
   Check remote.unknown shell script.  */

#include "uucp.h"

#include "uudefs.h"
#include "sysdep.h"
#include "system.h"

#include <errno.h>

/* Run the remote.unknown shell script.  If it succeeds, we return
   FALSE because that means that the system is not permitted to log
   in.  If the execution fails, we return TRUE.  */

boolean
fsysdep_unknown_caller (zscript, zsystem)
     const char *zscript;
     const char *zsystem;
{
  const char *azargs[3];
  int aidescs[3];
  pid_t ipid;

  azargs[0] = zscript;
  azargs[1] = zsystem;
  azargs[2] = NULL;

  aidescs[0] = SPAWN_NULL;
  aidescs[1] = SPAWN_NULL;
  aidescs[2] = SPAWN_NULL;

  ipid = ixsspawn (azargs, aidescs, TRUE, TRUE, (const char *) NULL, FALSE,
		   TRUE, (const char *) NULL, (const char *) NULL,
		   (const char *) NULL);
  if (ipid < 0)
    {
      ulog (LOG_ERROR, "ixsspawn: %s", strerror (errno));
      return FALSE;
    }

  return ixswait ((unsigned long) ipid, (const char *) NULL) != 0;
}
OpenPOWER on IntegriCloud