関数 | |
static DNS_ERROR | LabelList (TALLOC_CTX *mem_ctx, const char *name, struct dns_domain_label **presult) |
DNS_ERROR | dns_domain_name_from_string (TALLOC_CTX *mem_ctx, const char *pszDomainName, struct dns_domain_name **presult) |
char * | dns_generate_keyname (TALLOC_CTX *mem_ctx) |
static DNS_ERROR LabelList | ( | TALLOC_CTX * | mem_ctx, | |
const char * | name, | |||
struct dns_domain_label ** | presult | |||
) | [static] |
dnsutils.c の 30 行で定義されています。
参照先 c・err・result・talloc_strdup()・talloc_strndup().
参照元 dns_domain_name_from_string().
00033 { 00034 struct dns_domain_label *result; 00035 const char *dot; 00036 00037 for (dot = name; *dot != '\0'; dot += 1) { 00038 char c = *dot; 00039 00040 if (c == '.') 00041 break; 00042 00043 if (c == '-') continue; 00044 if ((c >= 'a') && (c <= 'z')) continue; 00045 if ((c >= 'A') && (c <= 'Z')) continue; 00046 if ((c >= '0') && (c <= '9')) continue; 00047 00048 return ERROR_DNS_INVALID_NAME; 00049 } 00050 00051 if ((dot - name) > 63) { 00052 /* 00053 * DNS labels can only be 63 chars long 00054 */ 00055 return ERROR_DNS_INVALID_NAME; 00056 } 00057 00058 if (!(result = TALLOC_ZERO_P(mem_ctx, struct dns_domain_label))) { 00059 return ERROR_DNS_NO_MEMORY; 00060 } 00061 00062 if (*dot == '\0') { 00063 /* 00064 * No dot around, so this is the last component 00065 */ 00066 00067 if (!(result->label = talloc_strdup(result, name))) { 00068 TALLOC_FREE(result); 00069 return ERROR_DNS_NO_MEMORY; 00070 } 00071 result->len = strlen(result->label); 00072 *presult = result; 00073 return ERROR_DNS_SUCCESS; 00074 } 00075 00076 if (dot[1] == '.') { 00077 /* 00078 * Two dots in a row, reject 00079 */ 00080 00081 TALLOC_FREE(result); 00082 return ERROR_DNS_INVALID_NAME; 00083 } 00084 00085 if (dot[1] != '\0') { 00086 /* 00087 * Something follows, get the rest 00088 */ 00089 00090 DNS_ERROR err = LabelList(result, dot+1, &result->next); 00091 00092 if (!ERR_DNS_IS_OK(err)) { 00093 TALLOC_FREE(result); 00094 return err; 00095 } 00096 } 00097 00098 result->len = (dot - name); 00099 00100 if (!(result->label = talloc_strndup(result, name, result->len))) { 00101 TALLOC_FREE(result); 00102 return ERROR_DNS_NO_MEMORY; 00103 } 00104 00105 *presult = result; 00106 return ERROR_DNS_SUCCESS; 00107 }
DNS_ERROR dns_domain_name_from_string | ( | TALLOC_CTX * | mem_ctx, | |
const char * | pszDomainName, | |||
struct dns_domain_name ** | presult | |||
) |
dnsutils.c の 109 行で定義されています。
参照先 err・LabelList()・result.
参照元 dns_create_query()・dns_create_rrec()・dns_create_tkey_record()・dns_create_tsig_record()・dns_create_update()・dns_sign_update().
00112 { 00113 struct dns_domain_name *result; 00114 DNS_ERROR err; 00115 00116 if (!(result = talloc(mem_ctx, struct dns_domain_name))) { 00117 return ERROR_DNS_NO_MEMORY; 00118 } 00119 00120 err = LabelList( result, pszDomainName, &result->pLabelList ); 00121 if (!ERR_DNS_IS_OK(err)) { 00122 TALLOC_FREE(result); 00123 return err; 00124 } 00125 00126 *presult = result; 00127 return ERROR_DNS_SUCCESS; 00128 }
char* dns_generate_keyname | ( | TALLOC_CTX * | mem_ctx | ) |
dnsutils.c の 133 行で定義されています。
参照先 result.
参照元 DoDNSUpdate().
00134 { 00135 char *result = NULL; 00136 #if defined(WITH_DNS_UPDATES) 00137 00138 uuid_t uuid; 00139 00140 /* 00141 * uuid_unparse gives 36 bytes plus '\0' 00142 */ 00143 if (!(result = TALLOC_ARRAY(mem_ctx, char, 37))) { 00144 return NULL; 00145 } 00146 00147 uuid_generate( uuid ); 00148 uuid_unparse( uuid, result ); 00149 00150 #endif 00151 00152 return result; 00153 }