~ubuntu-branches/ubuntu/precise/stunnel4/precise-security

« back to all changes in this revision

Viewing changes to src/pty.c

  • Committer: Bazaar Package Importer
  • Author(s): Julien Lemoine
  • Date: 2005-04-20 21:07:50 UTC
  • mfrom: (1.1.1 upstream) (2.1.1 hoary)
  • Revision ID: james.westby@ubuntu.com-20050420210750-0vk5fj5vh75o4d00
Tags: 2:4.090-1
* New upstream release
* include better stunnel3 compability script from upstream, options 
  like -cd can now be use instead of -c -d ...
  (closes: #305259)
* Added depends on perl-modules to allow use of stunnel3 compatibilty script

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 *   stunnel       Universal SSL tunnel
3
 
 *   Copyright (c) 1998-2004 Michal Trojnara <Michal.Trojnara@mirt.net>
 
3
 *   Copyright (c) 1998-2005 Michal Trojnara <Michal.Trojnara@mirt.net>
4
4
 *                 All Rights Reserved
5
5
 *
6
6
 *   Based on a Public Domain code by Tatu Ylonen <ylo@cs.hut.fi>
121
121
    }
122
122
    pts = ptsname(ptm);
123
123
    if (pts == NULL)
124
 
        log(LOG_ERR, "Slave pty side name could not be obtained");
 
124
        s_log(LOG_ERR, "Slave pty side name could not be obtained");
125
125
    safecopy(namebuf, pts);
126
126
    *ptyfd = ptm;
127
127
 
152
152
    }
153
153
    name = ttyname(*ptyfd);
154
154
    if (!name) {
155
 
        log(LOG_ERR, "Open of /dev/ptc returns device for which ttyname fails");
 
155
        s_log(LOG_ERR, "Open of /dev/ptc returns device for which ttyname fails");
156
156
        return -1;
157
157
    }
158
158
    safecopy(namebuf, name);
214
214
 
215
215
void pty_release(char *tty_name) {
216
216
    if(chown(tty_name, (uid_t)0, (gid_t)0)<0)
217
 
        log(LOG_DEBUG, "chown %.100s 0 0 failed: %.100s", tty_name,
 
217
        s_log(LOG_DEBUG, "chown %.100s 0 0 failed: %.100s", tty_name,
218
218
            strerror(get_last_socket_error()));
219
219
    if(chmod(tty_name, (mode_t)0666)<0)
220
 
        log(LOG_DEBUG, "chmod %.100s 0666 failed: %.100s", tty_name,
 
220
        s_log(LOG_DEBUG, "chmod %.100s 0666 failed: %.100s", tty_name,
221
221
            strerror(get_last_socket_error()));
222
222
}
223
223
 
243
243
     */
244
244
    fd = open("/dev/tty", O_RDWR | O_NOCTTY);
245
245
    if (fd >= 0) {
246
 
        log(LOG_ERR, "Failed to disconnect from controlling tty");
 
246
        s_log(LOG_ERR, "Failed to disconnect from controlling tty");
247
247
        close(fd);
248
248
    }
249
249
    /* Make it our controlling tty. */
250
250
#ifdef TIOCSCTTY
251
 
    log(LOG_DEBUG, "Setting controlling tty using TIOCSCTTY");
 
251
    s_log(LOG_DEBUG, "Setting controlling tty using TIOCSCTTY");
252
252
    /*
253
253
     * We ignore errors from this, because HPSUX defines TIOCSCTTY, but
254
254
     * returns EINVAL with these arguments, and there is absolutely no