Fixes warnings produced by GCC 4.6.1.
static int do_dumpBER(FILE *f, const char *buf, int len, int level, int offset)
{
int res, ll, zclass, tag, cons, lenlen, taglen;
- const char *b = buf, *bp = buf;
+ const char *b = buf;
if (!len)
return 0;
b += res;
taglen = res;
len -= res;
- bp = b;
if ((res = ber_declen((unsigned char*)b, &ll, len)) <= 0)
{
fprintf(f, "\n%*sBad length\n", level*4+5, "");
Z_External *z_ext_record_oid(ODR o, const Odr_oid *oid, const char *buf, int len)
{
Z_External *thisext;
- char oid_str_buf[OID_STR_MAX];
- const char *oid_str;
- oid_class oclass;
if (!oid)
return 0;
thisext = (Z_External *) odr_malloc(o, sizeof(*thisext));
thisext->descriptor = 0;
thisext->indirect_reference = 0;
-
- oid_str = yaz_oid_to_string_buf(oid, &oclass, oid_str_buf);
-
thisext->direct_reference = odr_oiddup(o, oid);
if (len < 0) /* Structured data */
const char *buf, int len)
{
Z_External *thisext;
- char oid_str_buf[OID_STR_MAX];
- const char *oid_str;
- oid_class oclass;
if (!oid)
return 0;
thisext = (Z_External *) odr_malloc(o, sizeof(*thisext));
thisext->descriptor = 0;
thisext->indirect_reference = 0;
-
- oid_str = yaz_oid_to_string_buf(oid, &oclass, oid_str_buf);
-
thisext->direct_reference = odr_oiddup(o, oid);
thisext->which = Z_External_single;
void *cs_get_ssl(COMSTACK cs)
{
#if HAVE_OPENSSL_SSL_H
- struct tcpip_state *sp;
- if (!cs || cs->type != ssl_type)
- return 0;
- sp = (struct tcpip_state *) cs->cprivate;
- return sp->ssl;
-#else
- return 0;
+ if (cs && cs->type == ssl_type)
+ {
+ struct tcpip_state *sp = (struct tcpip_state *) cs->cprivate;
+ return sp->ssl;
+ }
#endif
+ return 0;
}
int cs_set_ssl_ctx(COMSTACK cs, void *ctx)
{
#if ENABLE_SSL
- struct tcpip_state *sp;
- if (!cs || cs->type != ssl_type)
- return 0;
- sp = (struct tcpip_state *) cs->cprivate;
+ if (cs && cs->type == ssl_type)
+ {
#if HAVE_OPENSSL_SSL_H
- if (sp->ctx_alloc)
- return 0;
- sp->ctx = (SSL_CTX *) ctx;
+ struct tcpip_state *sp = (struct tcpip_state *) cs->cprivate;
+ if (sp->ctx_alloc)
+ return 0;
+ sp->ctx = (SSL_CTX *) ctx;
#endif
- return 1;
-#else
- return 0;
+ return 1;
+ }
#endif
+ return 0;
}
int cs_set_ssl_certificate_file(COMSTACK cs, const char *fname)
{
#if ENABLE_SSL
- struct tcpip_state *sp;
- if (!cs || cs->type != ssl_type)
- return 0;
- sp = (struct tcpip_state *) cs->cprivate;
- strncpy(sp->cert_fname, fname, sizeof(sp->cert_fname)-1);
- sp->cert_fname[sizeof(sp->cert_fname)-1] = '\0';
- return 1;
-#else
- return 0;
+ if (cs && cs->type == ssl_type)
+ {
+ struct tcpip_state *sp = (struct tcpip_state *) cs->cprivate;
+ strncpy(sp->cert_fname, fname, sizeof(sp->cert_fname)-1);
+ sp->cert_fname[sizeof(sp->cert_fname)-1] = '\0';
+ return 1;
+ }
#endif
+ return 0;
}
int cs_get_peer_certificate_x509(COMSTACK cs, char **buf, int *len)