Lines Matching refs:sb

53 static int nsldapi_sasl_close( LDAP *ld, Sockbuf *sb );
54 static void destroy_sasliobuf(Sockbuf *sb);
148 Sockbuf *sb = (Sockbuf *)arg;
155 if (sb == NULL) {
159 ld = (LDAP *)sb->sb_sasl_prld;
165 if ((ret = sb->sb_sasl_ilen) > 0) {
167 SAFEMEMCPY( buf, sb->sb_sasl_iptr, ret );
168 if (ret == sb->sb_sasl_ilen) {
169 sb->sb_sasl_ilen = 0;
170 sb->sb_sasl_iptr = NULL;
172 sb->sb_sasl_ilen -= ret;
173 sb->sb_sasl_iptr += ret;
179 cp = sb->sb_sasl_ibuf;
184 if (sb->sb_sasl_fns.lbextiofn_read != NULL) {
185 ret = sb->sb_sasl_fns.lbextiofn_read(
187 sb->sb_sasl_fns.lbextiofn_socket_arg);
189 ret = read( sb->sb_sd, cp, 4 - dlen );
204 ret = nsldapi_sasl_pktlen( sb->sb_sasl_ibuf, sb->sb_sasl_bfsz );
213 if (sb->sb_sasl_fns.lbextiofn_read != NULL) {
214 ret = sb->sb_sasl_fns.lbextiofn_read(
216 sb->sb_sasl_fns.lbextiofn_socket_arg);
218 ret = read( sb->sb_sd, cp, dlen );
234 ret = sasl_decode( sb->sb_sasl_ctx,
235 sb->sb_sasl_ibuf, blen,
239 sb->sb_sasl_iptr = NULL;
240 sb->sb_sasl_ilen = 0;
246 SAFEMEMCPY( sb->sb_sasl_ibuf, dbuf, dlen );
247 sb->sb_sasl_iptr = sb->sb_sasl_ibuf;
248 sb->sb_sasl_ilen = dlen;
251 SAFEMEMCPY( buf, sb->sb_sasl_iptr, ret );
252 if (ret == sb->sb_sasl_ilen) {
253 sb->sb_sasl_ilen = 0;
254 sb->sb_sasl_iptr = NULL;
256 sb->sb_sasl_ilen -= ret;
257 sb->sb_sasl_iptr += ret;
266 Sockbuf *sb = (Sockbuf *)arg;
272 if (sb == NULL) {
276 ret = sasl_getprop(sb->sb_sasl_ctx, SASL_MAXOUTBUF,
286 ret = sasl_encode( sb->sb_sasl_ctx, cbuf, clen, &obuf, &olen);
294 if (sb->sb_sasl_fns.lbextiofn_write != NULL) {
295 ret = sb->sb_sasl_fns.lbextiofn_write(
297 sb->sb_sasl_fns.lbextiofn_socket_arg);
299 ret = write( sb->sb_sd, optr, olen);
318 Sockbuf *sb = (Sockbuf *)arg;
322 if (sb == NULL) {
325 ld = (LDAP *)sb->sb_sasl_prld;
333 (struct lextiof_socket_private *)sb) {
336 sb->sb_sasl_fns.lbextiofn_socket_arg;
351 Sockbuf *sb = (Sockbuf *)arg;
353 if (sb == NULL) {
357 return( sb->sb_sasl_fns.lbextiofn_read( s, buf, len,
358 sb->sb_sasl_fns.lbextiofn_socket_arg) );
365 Sockbuf *sb = (Sockbuf *)arg;
367 if (sb == NULL) {
371 return( sb->sb_sasl_fns.lbextiofn_write( s, buf, len,
372 sb->sb_sasl_fns.lbextiofn_socket_arg) );
378 Sockbuf *sb = (Sockbuf *)arg;
381 if (sb == NULL) {
384 ld = (LDAP *)sb->sb_sasl_prld;
390 ber_sockbuf_set_option( sb,
392 (void *)&sb->sb_sasl_fns);
395 nsldapi_sasl_close( ld, sb );
399 sb->sb_sasl_fns.lbextiofn_socket_arg ) );
406 nsldapi_sasl_install( LDAP *ld, Sockbuf *sb, void *ctx_arg, sasl_ssf_t *ssf)
418 if ( sb == NULL ) {
421 rc = ber_sockbuf_get_option( sb,
429 sb->sb_sasl_ctx = (sasl_conn_t *)ctx_arg;
430 rc = sasl_getprop( sb->sb_sasl_ctx, SASL_SEC_PROPS,
438 if ((sb->sb_sasl_ibuf = NSLDAPI_MALLOC(bufsiz)) == NULL) {
441 sb->sb_sasl_iptr = NULL;
442 sb->sb_sasl_bfsz = bufsiz;
443 sb->sb_sasl_ilen = 0;
448 (void) memset( &sb->sb_sasl_fns, 0, LBER_X_EXTIO_FNS_SIZE);
449 sb->sb_sasl_fns.lbextiofn_size = LBER_X_EXTIO_FNS_SIZE;
450 rc = ber_sockbuf_get_option( sb,
452 (void *)&sb->sb_sasl_fns);
454 destroy_sasliobuf(sb);
462 destroy_sasliobuf(sb);
489 (void *) sb;
494 destroy_sasliobuf(sb);
497 sb->sb_sasl_prld = (void *)ld;
506 (void *) sb;
507 /* (void *)sb->sb_sasl_fns.lbextiofn_socket_arg; */
508 rc = ber_sockbuf_set_option( sb,
512 destroy_sasliobuf(sb);
571 Sockbuf *sb;
584 sb = ld->ld_defconn->lconn_sb;
587 if ( sb == NULL || host == NULL ) {
592 if (sb->sb_sasl_ctx) {
593 sasl_dispose(&sb->sb_sasl_ctx);
594 sb->sb_sasl_ctx = NULL;
615 sb->sb_sasl_ctx = (void *)ctx;
622 destroy_sasliobuf(Sockbuf *sb)
624 if (sb != NULL && sb->sb_sasl_ibuf != NULL) {
625 NSLDAPI_FREE(sb->sb_sasl_ibuf);
626 sb->sb_sasl_ibuf = NULL;
627 sb->sb_sasl_iptr = NULL;
628 sb->sb_sasl_bfsz = 0;
629 sb->sb_sasl_ilen = 0;
634 nsldapi_sasl_close( LDAP *ld, Sockbuf *sb )
636 sasl_conn_t *ctx = (sasl_conn_t *)sb->sb_sasl_ctx;
638 destroy_sasliobuf(sb);
642 sb->sb_sasl_ctx = NULL;