~ubuntu-branches/ubuntu/maverick/krb5/maverick

« back to all changes in this revision

Viewing changes to src/appl/telnet/telnetd/sys_term.c

  • Committer: Bazaar Package Importer
  • Author(s): Sam Hartman
  • Date: 2009-05-07 16:16:34 UTC
  • mfrom: (13.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20090507161634-xqyk0s9na0le4flj
Tags: 1.7dfsg~beta1-4
When  decrypting the TGS response fails with the subkey, try with the
session key to work around Heimdal bug, Closes: #527353 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1133
1133
         */
1134
1134
        if ((i = open(INIT_FIFO, O_WRONLY)) < 0) {
1135
1135
                char tbuf[128];
1136
 
                (void) sprintf(tbuf, "Can't open %s\n", INIT_FIFO);
 
1136
                (void) snprintf(tbuf, sizeof(tbuf), "Can't open %s\n",
 
1137
                                INIT_FIFO);
1137
1138
                fatalperror(net, tbuf);
1138
1139
        }
1139
1140
        memset((char *)&request, 0, sizeof(request));
1156
1157
#endif /* BFTPDAEMON */
1157
1158
        if (write(i, (char *)&request, sizeof(request)) < 0) {
1158
1159
                char tbuf[128];
1159
 
                (void) sprintf(tbuf, "Can't write to %s\n", INIT_FIFO);
 
1160
                (void) snprintf(tbuf, sizeof(tbuf), "Can't write to %s\n",
 
1161
                                INIT_FIFO);
1160
1162
                fatalperror(net, tbuf);
1161
1163
        }
1162
1164
        (void) close(i);
1168
1170
                if (i == 3 || n >= 0 || !gotalarm)
1169
1171
                        break;
1170
1172
                gotalarm = 0;
1171
 
                sprintf(tbuf, "telnetd: waiting for /etc/init to start login process on %s\r\n", line);
 
1173
                snprintf(tbuf, sizeof(tbuf), "telnetd: waiting for /etc/init to start login process on %s\r\n", line);
1172
1174
                (void) write(net, tbuf, strlen(tbuf));
1173
1175
        }
1174
1176
        if (n < 0 && gotalarm)
1255
1257
                if (term == NULL || term[0] == 0) {
1256
1258
                        term = "-";
1257
1259
                } else {
1258
 
                        strcpy(termbuf, "TERM=");
1259
 
                        strncat(termbuf, term, sizeof(termbuf) - 6);
1260
 
                        termbuf[sizeof(termbuf) - 1] = '\0';
 
1260
                        snprintf(termbuf, sizeof(termbuf), "TERM=%s", term);
1261
1261
                        term = termbuf;
1262
1262
                }
1263
1263
                argv = addarg(argv, term);
1357
1357
                        write(xpty, name, len);
1358
1358
                        write(xpty, name, len);
1359
1359
                        memset(speed, 0, sizeof(speed));
1360
 
                        strncpy(speed,
1361
 
                                (cp = getenv("TERM")) ? cp : "",
1362
 
                                sizeof(speed)-1-(10*sizeof(def_rspeed)/4)-1);
1363
 
                        /* 1 for /, () for the number, 1 for trailing 0. */
1364
 
                        sprintf(speed + strlen(speed),
1365
 
                                "/%d",
1366
 
                                (def_rspeed > 0) ? def_rspeed : 9600);
 
1360
                        snprintf(speed, sizeof(speed), "%s/%d",
 
1361
                                 (cp = getenv("TERM")) ? cp : "",
 
1362
                                 (def_rspeed > 0) ? def_rspeed : 9600);
1367
1363
                        len = strlen(speed)+1;
1368
1364
                        write(xpty, speed, len);
1369
1365