⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 context.c

📁 samba最新软件
💻 C
📖 第 1 页 / 共 2 页
字号:
const krb5_enctype * KRB5_LIB_FUNCTIONkrb5_kerberos_enctypes(krb5_context context){    static const krb5_enctype p[] = {	ETYPE_AES256_CTS_HMAC_SHA1_96,	ETYPE_AES128_CTS_HMAC_SHA1_96,	ETYPE_DES3_CBC_SHA1,	ETYPE_DES3_CBC_MD5,	ETYPE_ARCFOUR_HMAC_MD5,	ETYPE_DES_CBC_MD5,	ETYPE_DES_CBC_MD4,	ETYPE_DES_CBC_CRC,	ETYPE_NULL    };    return p;}/* * set `etype' to a malloced list of the default enctypes */static krb5_error_codedefault_etypes(krb5_context context, krb5_enctype **etype){    const krb5_enctype *p;    krb5_enctype *e = NULL, *ep;    int i, n = 0;    p = krb5_kerberos_enctypes(context);    for (i = 0; p[i] != ETYPE_NULL; i++) {	if (krb5_enctype_valid(context, p[i]) != 0)	    continue;	ep = realloc(e, (n + 2) * sizeof(*e));	if (ep == NULL) {	    free(e);	    krb5_set_error_string (context, "malloc: out of memory");	    return ENOMEM;	}	e = ep;	e[n] = p[i];	e[n + 1] = ETYPE_NULL;	n++;    }    *etype = e;    return 0;}/** * Set the default encryption types that will be use in communcation * with the KDC, clients and servers. * * @param context Kerberos 5 context. * @param etypes Encryption types, array terminated with ETYPE_NULL (0). * * @return Returns 0 to indicate success. Otherwise an kerberos et * error code is returned, see krb5_get_error_message(). * * @ingroup krb5 */krb5_error_code KRB5_LIB_FUNCTIONkrb5_set_default_in_tkt_etypes(krb5_context context, 			       const krb5_enctype *etypes){    krb5_enctype *p = NULL;    int i;    if(etypes) {	for (i = 0; etypes[i]; ++i) {	    krb5_error_code ret;	    ret = krb5_enctype_valid(context, etypes[i]);	    if (ret)		return ret;	}	++i;	ALLOC(p, i);	if(!p) {	    krb5_set_error_string (context, "malloc: out of memory");	    return ENOMEM;	}	memmove(p, etypes, i * sizeof(krb5_enctype));    }    if(context->etypes)	free(context->etypes);    context->etypes = p;    return 0;}/** * Get the default encryption types that will be use in communcation * with the KDC, clients and servers. * * @param context Kerberos 5 context. * @param etypes Encryption types, array terminated with * ETYPE_NULL(0), caller should free array with krb5_xfree(): * * @return Returns 0 to indicate success. Otherwise an kerberos et * error code is returned, see krb5_get_error_message(). * * @ingroup krb5 */krb5_error_code KRB5_LIB_FUNCTIONkrb5_get_default_in_tkt_etypes(krb5_context context,			       krb5_enctype **etypes){  krb5_enctype *p;  int i;  krb5_error_code ret;  if(context->etypes) {    for(i = 0; context->etypes[i]; i++);    ++i;    ALLOC(p, i);    if(!p) {      krb5_set_error_string (context, "malloc: out of memory");      return ENOMEM;    }    memmove(p, context->etypes, i * sizeof(krb5_enctype));  } else {    ret = default_etypes(context, &p);    if (ret)      return ret;  }  *etypes = p;  return 0;}/** * Return the error string for the error code. The caller must not * free the string. * * @param context Kerberos 5 context. * @param code Kerberos error code. * * @return the error message matching code * * @ingroup krb5 */const char* KRB5_LIB_FUNCTIONkrb5_get_err_text(krb5_context context, krb5_error_code code){    const char *p = NULL;    if(context != NULL)	p = com_right(context->et_list, code);    if(p == NULL)	p = strerror(code);    if (p == NULL)	p = "Unknown error";    return p;}/** * Init the built-in ets in the Kerberos library.  * * @param context kerberos context to add the ets too * * @ingroup krb5 */void KRB5_LIB_FUNCTIONkrb5_init_ets(krb5_context context){    if(context->et_list == NULL){	krb5_add_et_list(context, initialize_krb5_error_table_r);	krb5_add_et_list(context, initialize_asn1_error_table_r);	krb5_add_et_list(context, initialize_heim_error_table_r);	krb5_add_et_list(context, initialize_k524_error_table_r);#ifdef PKINIT	krb5_add_et_list(context, initialize_hx_error_table_r);#endif    }}/** * Make the kerberos library default to the admin KDC. * * @param context Kerberos 5 context. * @param flag boolean flag to select if the use the admin KDC or not. * * @ingroup krb5 */void KRB5_LIB_FUNCTIONkrb5_set_use_admin_kdc (krb5_context context, krb5_boolean flag){    context->use_admin_kdc = flag;}/** * Make the kerberos library default to the admin KDC. * * @param context Kerberos 5 context. * * @return boolean flag to telling the context will use admin KDC as the default KDC. * * @ingroup krb5 */krb5_boolean KRB5_LIB_FUNCTIONkrb5_get_use_admin_kdc (krb5_context context){    return context->use_admin_kdc;}/** * Add extra address to the address list that the library will add to * the client's address list when communicating with the KDC. * * @param context Kerberos 5 context. * @param addresses addreses to add * * @return Returns 0 to indicate success. Otherwise an kerberos et * error code is returned, see krb5_get_error_message(). * * @ingroup krb5 */krb5_error_code KRB5_LIB_FUNCTIONkrb5_add_extra_addresses(krb5_context context, krb5_addresses *addresses){    if(context->extra_addresses)	return krb5_append_addresses(context, 				     context->extra_addresses, addresses);    else	return krb5_set_extra_addresses(context, addresses);}/** * Set extra address to the address list that the library will add to * the client's address list when communicating with the KDC. * * @param context Kerberos 5 context. * @param addresses addreses to set * * @return Returns 0 to indicate success. Otherwise an kerberos et * error code is returned, see krb5_get_error_message(). * * @ingroup krb5 */krb5_error_code KRB5_LIB_FUNCTIONkrb5_set_extra_addresses(krb5_context context, const krb5_addresses *addresses){    if(context->extra_addresses)	krb5_free_addresses(context, context->extra_addresses);    if(addresses == NULL) {	if(context->extra_addresses != NULL) {	    free(context->extra_addresses);	    context->extra_addresses = NULL;	}	return 0;    }    if(context->extra_addresses == NULL) {	context->extra_addresses = malloc(sizeof(*context->extra_addresses));	if(context->extra_addresses == NULL) {	    krb5_set_error_string (context, "malloc: out of memory");	    return ENOMEM;	}    }    return krb5_copy_addresses(context, addresses, context->extra_addresses);}/** * Get extra address to the address list that the library will add to * the client's address list when communicating with the KDC. * * @param context Kerberos 5 context. * @param addresses addreses to set * * @return Returns 0 to indicate success. Otherwise an kerberos et * error code is returned, see krb5_get_error_message(). * * @ingroup krb5 */krb5_error_code KRB5_LIB_FUNCTIONkrb5_get_extra_addresses(krb5_context context, krb5_addresses *addresses){    if(context->extra_addresses == NULL) {	memset(addresses, 0, sizeof(*addresses));	return 0;    }    return krb5_copy_addresses(context,context->extra_addresses, addresses);}/** * Add extra addresses to ignore when fetching addresses from the * underlaying operating system. * * @param context Kerberos 5 context. * @param addresses addreses to ignore * * @return Returns 0 to indicate success. Otherwise an kerberos et * error code is returned, see krb5_get_error_message(). * * @ingroup krb5 */krb5_error_code KRB5_LIB_FUNCTIONkrb5_add_ignore_addresses(krb5_context context, krb5_addresses *addresses){    if(context->ignore_addresses)	return krb5_append_addresses(context, 				     context->ignore_addresses, addresses);    else	return krb5_set_ignore_addresses(context, addresses);}/** * Set extra addresses to ignore when fetching addresses from the * underlaying operating system. * * @param context Kerberos 5 context. * @param addresses addreses to ignore * * @return Returns 0 to indicate success. Otherwise an kerberos et * error code is returned, see krb5_get_error_message(). * * @ingroup krb5 */krb5_error_code KRB5_LIB_FUNCTIONkrb5_set_ignore_addresses(krb5_context context, const krb5_addresses *addresses){    if(context->ignore_addresses)	krb5_free_addresses(context, context->ignore_addresses);    if(addresses == NULL) {	if(context->ignore_addresses != NULL) {	    free(context->ignore_addresses);	    context->ignore_addresses = NULL;	}	return 0;    }    if(context->ignore_addresses == NULL) {	context->ignore_addresses = malloc(sizeof(*context->ignore_addresses));	if(context->ignore_addresses == NULL) {	    krb5_set_error_string (context, "malloc: out of memory");	    return ENOMEM;	}    }    return krb5_copy_addresses(context, addresses, context->ignore_addresses);}/** * Get extra addresses to ignore when fetching addresses from the * underlaying operating system. * * @param context Kerberos 5 context. * @param addresses list addreses ignored * * @return Returns 0 to indicate success. Otherwise an kerberos et * error code is returned, see krb5_get_error_message(). * * @ingroup krb5 */krb5_error_code KRB5_LIB_FUNCTIONkrb5_get_ignore_addresses(krb5_context context, krb5_addresses *addresses){    if(context->ignore_addresses == NULL) {	memset(addresses, 0, sizeof(*addresses));	return 0;    }    return krb5_copy_addresses(context, context->ignore_addresses, addresses);}/** * Set version of fcache that the library should use. * * @param context Kerberos 5 context. * @param version version number. * * @return Returns 0 to indicate success. Otherwise an kerberos et * error code is returned, see krb5_get_error_message(). * * @ingroup krb5 */krb5_error_code KRB5_LIB_FUNCTIONkrb5_set_fcache_version(krb5_context context, int version){    context->fcache_vno = version;    return 0;}/** * Get version of fcache that the library should use. * * @param context Kerberos 5 context. * @param version version number. * * @return Returns 0 to indicate success. Otherwise an kerberos et * error code is returned, see krb5_get_error_message(). * * @ingroup krb5 */krb5_error_code KRB5_LIB_FUNCTIONkrb5_get_fcache_version(krb5_context context, int *version){    *version = context->fcache_vno;    return 0;}/** * Runtime check if the Kerberos library was complied with thread support. * * @return TRUE if the library was compiled with thread support, FALSE if not. * * @ingroup krb5 */krb5_boolean KRB5_LIB_FUNCTIONkrb5_is_thread_safe(void){#ifdef ENABLE_PTHREAD_SUPPORT    return TRUE;#else    return FALSE;#endif}/** * Set if the library should use DNS to canonicalize hostnames. * * @param context Kerberos 5 context. * @param flag if its dns canonicalizion is used or not. * * @ingroup krb5 */void KRB5_LIB_FUNCTIONkrb5_set_dns_canonicalize_hostname (krb5_context context, krb5_boolean flag){    if (flag)	context->flags |= KRB5_CTX_F_DNS_CANONICALIZE_HOSTNAME;    else	context->flags &= ~KRB5_CTX_F_DNS_CANONICALIZE_HOSTNAME;}/** * Get if the library uses DNS to canonicalize hostnames. * * @param context Kerberos 5 context. * * @return return non zero if the library uses DNS to canonicalize hostnames. * * @ingroup krb5 */krb5_boolean KRB5_LIB_FUNCTIONkrb5_get_dns_canonicalize_hostname (krb5_context context){    return (context->flags & KRB5_CTX_F_DNS_CANONICALIZE_HOSTNAME) ? 1 : 0;}/** * Get current offset in time to the KDC. * * @param context Kerberos 5 context. * @param sec seconds part of offset. * @param usec micro seconds part of offset. * * @return return non zero if the library uses DNS to canonicalize hostnames. * * @ingroup krb5 */krb5_error_code KRB5_LIB_FUNCTIONkrb5_get_kdc_sec_offset (krb5_context context, int32_t *sec, int32_t *usec){    if (sec)	*sec = context->kdc_sec_offset;    if (usec)	*usec = context->kdc_usec_offset;    return 0;}/** * Get max time skew allowed. * * @param context Kerberos 5 context. * * @return timeskew in seconds. * * @ingroup krb5 */time_t KRB5_LIB_FUNCTIONkrb5_get_max_time_skew (krb5_context context){    return context->max_skew;}/** * Set max time skew allowed. * * @param context Kerberos 5 context. * @param t timeskew in seconds. * * @ingroup krb5 */void KRB5_LIB_FUNCTIONkrb5_set_max_time_skew (krb5_context context, time_t t){    context->max_skew = t;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -