- memset( &sb, 0, sizeof(sb) );
- sb.sb_sd = 0;
- sb.sb_ber.ber_buf = NULL;
+ sb = ber_sockbuf_alloc();
+ fd = fileno( stdin );
+ ber_sockbuf_add_io( sb, &ber_sockbuf_io_fd, LBER_SBIOD_LEVEL_PROVIDER,
+ (void *)&fd );
+
+ ber = ber_alloc_t(LBER_USE_DER);
+ if( ber == NULL ) {
+ perror( "ber_alloc_t" );
+ return( EXIT_FAILURE );
+ }
+
+ for (;;) {
+ tag = ber_get_next( sb, &len, ber);
+ if( tag != LBER_ERROR ) break;
+
+ if( errno == EWOULDBLOCK ) continue;
+ if( errno == EAGAIN ) continue;