diff options
author | Volker Lendecke <vl@samba.org> | 2008-01-25 23:41:48 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2008-02-02 11:03:22 +0100 |
commit | 5e43eeb1b6eef7ea7a88ffc51a0a0535e9bd8023 (patch) | |
tree | 89fafb0e619e518499d7ff0f7ab8078e509f8628 /source3/smbd/chgpasswd.c | |
parent | e514cd0af56031cd0396e716e9e77edf897420e9 (diff) | |
download | samba-5e43eeb1b6eef7ea7a88ffc51a0a0535e9bd8023.tar.gz |
Get rid of read_socket_with_timeout
(This used to be commit f9c8ac83ff42137d2101d3bb17e5dcc3c3d70a8f)
Diffstat (limited to 'source3/smbd/chgpasswd.c')
-rw-r--r-- | source3/smbd/chgpasswd.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/source3/smbd/chgpasswd.c b/source3/smbd/chgpasswd.c index 668c8e20957..bd5ff1f5232 100644 --- a/source3/smbd/chgpasswd.c +++ b/source3/smbd/chgpasswd.c @@ -239,7 +239,8 @@ static int dochild(int master, const char *slavedev, const struct passwd *pass, static int expect(int master, char *issue, char *expected) { char buffer[1024]; - int attempts, timeout, nread, len; + int attempts, timeout, nread; + size_t len; bool match = False; for (attempts = 0; attempts < 2; attempts++) { @@ -248,7 +249,8 @@ static int expect(int master, char *issue, char *expected) DEBUG(100, ("expect: sending [%s]\n", issue)); if ((len = sys_write(master, issue, strlen(issue))) != strlen(issue)) { - DEBUG(2,("expect: (short) write returned %d\n", len )); + DEBUG(2,("expect: (short) write returned %d\n", + (int)len )); return False; } } @@ -261,9 +263,16 @@ static int expect(int master, char *issue, char *expected) nread = 0; buffer[nread] = 0; - while ((len = read_socket_with_timeout(master, buffer + nread, 1, - sizeof(buffer) - nread - 1, - timeout, NULL)) > 0) { + while (True) { + NTSTATUS status; + status = read_socket_with_timeout_ntstatus( + master, buffer + nread, 1, + sizeof(buffer) - nread - 1, + timeout, &len); + + if (!NT_STATUS_IS_OK(status)) { + break; + } nread += len; buffer[nread] = 0; |