(proto): be more careful with the return value from krb5_net_read
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6818 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -146,6 +146,7 @@ proto (int sock, const char *service)
|
||||
krb5_ccache ccache;
|
||||
char ccname[MAXPATHLEN];
|
||||
struct passwd *pwd;
|
||||
ssize_t n;
|
||||
|
||||
status = krb5_auth_con_init (context, &auth_context);
|
||||
if (status)
|
||||
@@ -204,13 +205,19 @@ proto (int sock, const char *service)
|
||||
krb5_data_zero (&data);
|
||||
krb5_data_zero (&packet);
|
||||
|
||||
if (krb5_net_read (context, &sock, &net_len, 4) != 4)
|
||||
syslog_and_die("krb5_net_read: %s",strerror(errno));
|
||||
n = krb5_net_read (context, &sock, &net_len, 4);
|
||||
if (n < 0)
|
||||
syslog_and_die("krb5_net_read: %s", strerror(errno));
|
||||
if (n == 0)
|
||||
syslog_and_die("EOF in krb5_net_read");
|
||||
|
||||
len = ntohl(net_len);
|
||||
krb5_data_alloc (&packet, len);
|
||||
if (krb5_net_read (context, &sock, packet.data, len) != len)
|
||||
syslog_and_die("krb5_net_read: %s",strerror(errno));
|
||||
n = krb5_net_read (context, &sock, packet.data, len);
|
||||
if (n < 0)
|
||||
syslog_and_die("krb5_net_read: %s", strerror(errno));
|
||||
if (n == 0)
|
||||
syslog_and_die("EOF in krb5_net_read");
|
||||
|
||||
status = krb5_rd_priv (context,
|
||||
auth_context,
|
||||
|
Reference in New Issue
Block a user