Deleted Added
sdiff udiff text old ( 102528 ) new ( 110560 )
full compact
1/*
2 * Copyright (c) 1999-2002 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
4 *
5 * By using this file, you agree to the terms and conditions set
6 * forth in the LICENSE file which can be found at the top level of
7 * the sendmail distribution.
8 *
9 */
10
11#include <sm/gen.h>
12SM_RCSID("@(#)$Id: sfsasl.c,v 8.91.2.1 2002/08/27 01:35:17 ca Exp $")
13#include <stdlib.h>
14#include <sendmail.h>
15#include <errno.h>
16#if SASL
17# include "sfsasl.h"
18
19/* Structure used by the "sasl" file type */
20struct sasl_obj

--- 151 unchanged lines hidden (view full) ---

172sasl_read(fp, buf, size)
173 SM_FILE_T *fp;
174 char *buf;
175 size_t size;
176{
177 int result;
178 ssize_t len;
179# if SASL >= 20000
180 const char *outbuf = NULL;
181# else /* SASL >= 20000 */
182 static char *outbuf = NULL;
183# endif /* SASL >= 20000 */
184 static unsigned int outlen = 0;
185 static unsigned int offset = 0;
186 struct sasl_obj *so = (struct sasl_obj *) fp->f_cookie;
187
188 /*
189 ** sasl_decode() may require more data than a single read() returns.
190 ** Hence we have to put a loop around the decoding.
191 ** This also requires that we may have to split up the returned
192 ** data since it might be larger than the allowed size.
193 ** Therefore we use a static pointer and return portions of it
194 ** if necessary.
195 */
196
197 while (outbuf == NULL && outlen == 0)
198 {
199 len = sm_io_read(so->fp, SM_TIME_DEFAULT, buf, size);
200 if (len <= 0)
201 return len;
202 result = sasl_decode(so->conn, buf,
203 (unsigned int) len, &outbuf, &outlen);
204 if (result != SASL_OK)
205 {

--- 534 unchanged lines hidden ---