~ubuntu-branches/ubuntu/trusty/uucp/trusty

« back to all changes in this revision

Viewing changes to unix/tli.c

  • Committer: Bazaar Package Importer
  • Author(s): Peter Palfrader
  • Date: 2004-12-30 15:30:22 UTC
  • mfrom: (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20041230153022-mx4cdr9j3u9bldo3
Tags: 1.07-12
Add cs localisation for debconf templates (closes: #287305).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* tli.c
2
2
   Code to handle TLI connections.
3
3
 
4
 
   Copyright (C) 1992, 1993, 1994 Ian Lance Taylor
 
4
   Copyright (C) 1992, 1993, 1994, 2002 Ian Lance Taylor
5
5
 
6
6
   This file is part of the Taylor UUCP package.
7
7
 
17
17
 
18
18
   You should have received a copy of the GNU General Public License
19
19
   along with this program; if not, write to the Free Software
20
 
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
20
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
21
21
 
22
 
   The author of the program may be contacted at ian@airs.com or
23
 
   c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
 
22
   The author of the program may be contacted at ian@airs.com.
24
23
   */
25
24
 
26
25
#include "uucp.h"
27
26
 
28
27
#if USE_RCS_ID
29
 
const char tli_rcsid[] = "$Id: tli.c,v 1.4 1995/06/21 19:20:50 ian Rel $";
 
28
const char tli_rcsid[] = "$Id: tli.c,v 1.8 2002/03/05 19:10:42 ian Rel $";
30
29
#endif
31
30
 
32
31
#if HAVE_TLI
107
106
static void utli_free P((struct sconnection *qconn));
108
107
static boolean ftli_push P((struct sconnection *qconn));
109
108
static boolean ftli_open P((struct sconnection *qconn, long ibaud,
110
 
                            boolean fwait));
 
109
                            boolean fwait, boolean fuser));
111
110
static boolean ftli_close P((struct sconnection *qconn,
112
111
                             pointer puuconf,
113
112
                             struct uuconf_dialer *qdialer,
239
238
   system.  */
240
239
 
241
240
static boolean
242
 
ftli_open (qconn, ibaud, fwait)
 
241
ftli_open (qconn, ibaud, fwait, fuser)
243
242
     struct sconnection *qconn;
244
243
     long ibaud;
245
244
     boolean fwait;
 
245
     boolean fuser ATTRIBUTE_UNUSED;
246
246
{
247
247
  struct ssysdep_conn *qsysdep;
248
248
  const char *zdevice;
250
250
  const char *zservaddr;
251
251
  char *zfreeaddr;
252
252
  uid_t ieuid;
 
253
  gid_t iegid;
253
254
  boolean fswap;
254
255
  struct t_bind *qtbind;
255
256
  struct t_call *qtcall;
280
281
  fswap = fwait && geteuid () != 0;
281
282
  if (fswap)
282
283
    {
283
 
      if (! fsuser_perms (&ieuid))
 
284
      if (! fsuser_perms (&ieuid, &iegid))
284
285
        {
285
286
          ubuffree (zfreedev);
286
287
          return FALSE;
291
292
  if (qsysdep->o < 0)
292
293
    {
293
294
      if (fswap)
294
 
        (void) fsuucp_perms ((long) ieuid);
 
295
        (void) fsuucp_perms ((long) ieuid, (long) iegid);
295
296
      ulog (LOG_ERROR, "t_open (%s): %s", zdevice, ztlierror ());
296
297
      ubuffree (zfreedev);
297
298
      return FALSE;
301
302
             fcntl (qsysdep->o, F_GETFD, 0) | FD_CLOEXEC) < 0)
302
303
    {
303
304
      if (fswap)
304
 
        (void) fsuucp_perms ((long) ieuid);
 
305
        (void) fsuucp_perms ((long) ieuid, (long) iegid);
305
306
      ulog (LOG_ERROR, "fcntl (FD_CLOEXEC): %s", strerror (errno));
306
307
      ubuffree (zfreedev);
307
308
      (void) t_close (qsysdep->o);
313
314
  if (qsysdep->iflags < 0)
314
315
    {
315
316
      if (fswap)
316
 
        (void) fsuucp_perms ((long) ieuid);
 
317
        (void) fsuucp_perms ((long) ieuid, (long) iegid);
317
318
      ulog (LOG_ERROR, "fcntl: %s", strerror (errno));
318
319
      ubuffree (zfreedev);
319
320
      (void) t_close (qsysdep->o);
351
352
  if (qtbind == NULL)
352
353
    {
353
354
      if (fswap)
354
 
        (void) fsuucp_perms ((long) ieuid);
 
355
        (void) fsuucp_perms ((long) ieuid, (long) iegid);
355
356
      ulog (LOG_FATAL, "t_alloc (T_BIND): %s", ztlierror ());
356
357
    }
357
358
 
359
360
  if (zservaddr == NULL)
360
361
    {
361
362
      if (fswap)
362
 
        (void) fsuucp_perms ((long) ieuid);
 
363
        (void) fsuucp_perms ((long) ieuid, (long) iegid);
363
364
      ulog (LOG_FATAL, "Can't run as TLI server; no server address");
364
365
    }
365
366
 
368
369
  if (qtbind->addr.len > qtbind->addr.maxlen)
369
370
    {
370
371
      if (fswap)
371
 
        (void) fsuucp_perms ((long) ieuid);
 
372
        (void) fsuucp_perms ((long) ieuid, (long) iegid);
372
373
      ulog (LOG_FATAL, "%s: TLI server address too long (max %d)",
373
374
            zservaddr, qtbind->addr.maxlen);
374
375
    }
380
381
  if (t_bind (qsysdep->o, qtbind, (struct t_bind *) NULL) < 0)
381
382
    {
382
383
      if (fswap)
383
 
        (void) fsuucp_perms ((long) ieuid);
 
384
        (void) fsuucp_perms ((long) ieuid, (long) iegid);
384
385
      ulog (LOG_FATAL, "t_bind (%s): %s", zservaddr, ztlierror ());
385
386
    }
386
387
 
387
388
  if (fswap)
388
389
    {
389
 
      if (! fsuucp_perms ((long) ieuid))
 
390
      if (! fsuucp_perms ((long) ieuid, (long) iegid))
390
391
        ulog (LOG_FATAL, "Could not swap back to UUCP user permissions");
391
392
    }
392
393