Some notes
This commit is contained in:
parent
7e8283170c
commit
1502e8dab9
|
@ -1163,6 +1163,7 @@ request from '%s' [%ld] not handled due to missing permission"),
|
||||||
dbg_log ("\t%s", serv2str[req->type]);
|
dbg_log ("\t%s", serv2str[req->type]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HERE: request handler
|
||||||
/* Handle the request. */
|
/* Handle the request. */
|
||||||
switch (req->type)
|
switch (req->type)
|
||||||
{
|
{
|
||||||
|
|
|
@ -60,6 +60,7 @@ const struct iovec hst_iov_disabled =
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// HERE: interesting test cases
|
||||||
/* This is the standard reply in case we haven't found the dataset. */
|
/* This is the standard reply in case we haven't found the dataset. */
|
||||||
static const hst_response_header notfound =
|
static const hst_response_header notfound =
|
||||||
{
|
{
|
||||||
|
@ -269,19 +270,26 @@ cache_addhst (struct database_dyn *db, int fd, request_header *req,
|
||||||
|
|
||||||
cp = dataset->strdata;
|
cp = dataset->strdata;
|
||||||
|
|
||||||
|
// Payload????? Not sure :/
|
||||||
|
// 1. hname string
|
||||||
cp = mempcpy (cp, hst->h_name, h_name_len);
|
cp = mempcpy (cp, hst->h_name, h_name_len);
|
||||||
|
// 2. table containing the lenghts of each alias
|
||||||
cp = mempcpy (cp, h_aliases_len, h_aliases_cnt * sizeof (uint32_t));
|
cp = mempcpy (cp, h_aliases_len, h_aliases_cnt * sizeof (uint32_t));
|
||||||
|
|
||||||
/* The normal addresses first. */
|
/* The normal addresses first. */
|
||||||
addresses = cp;
|
addresses = cp;
|
||||||
|
// 3. Iterating on the result addr, serializing them. Each part is h_length wide.
|
||||||
|
// TODO: find h_length size.
|
||||||
for (cnt = 0; cnt < h_addr_list_cnt; ++cnt)
|
for (cnt = 0; cnt < h_addr_list_cnt; ++cnt)
|
||||||
cp = mempcpy (cp, hst->h_addr_list[cnt], hst->h_length);
|
cp = mempcpy (cp, hst->h_addr_list[cnt], hst->h_length);
|
||||||
|
|
||||||
|
// 4. Iterating on the aliases, serializing them one by one according to their size previously sent.
|
||||||
/* Then the aliases. */
|
/* Then the aliases. */
|
||||||
aliases = cp;
|
aliases = cp;
|
||||||
for (cnt = 0; cnt < h_aliases_cnt; ++cnt)
|
for (cnt = 0; cnt < h_aliases_cnt; ++cnt)
|
||||||
cp = mempcpy (cp, hst->h_aliases[cnt], h_aliases_len[cnt]);
|
cp = mempcpy (cp, hst->h_aliases[cnt], h_aliases_len[cnt]);
|
||||||
|
|
||||||
|
// 5. Size sanity check
|
||||||
assert (cp
|
assert (cp
|
||||||
== dataset->strdata + total - offsetof (struct dataset,
|
== dataset->strdata + total - offsetof (struct dataset,
|
||||||
strdata));
|
strdata));
|
||||||
|
@ -424,6 +432,7 @@ lookup (int type, void *key, struct hostent *resultbufp, char *buffer,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// HERE: top-level hst imp
|
||||||
static time_t
|
static time_t
|
||||||
addhstbyX (struct database_dyn *db, int fd, request_header *req,
|
addhstbyX (struct database_dyn *db, int fd, request_header *req,
|
||||||
void *key, uid_t uid, struct hashentry *he, struct datahead *dh)
|
void *key, uid_t uid, struct hashentry *he, struct datahead *dh)
|
||||||
|
|
|
@ -114,6 +114,7 @@ typedef struct
|
||||||
} gr_response_header;
|
} gr_response_header;
|
||||||
|
|
||||||
|
|
||||||
|
// HERE: header struct
|
||||||
/* Structure sent in reply to host query. Note that this struct is
|
/* Structure sent in reply to host query. Note that this struct is
|
||||||
sent also if the service is disabled or there is no record found. */
|
sent also if the service is disabled or there is no record found. */
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|
|
@ -129,6 +129,7 @@ __nscd_get_nl_timestamp (void)
|
||||||
|
|
||||||
int __nss_have_localdomain attribute_hidden;
|
int __nss_have_localdomain attribute_hidden;
|
||||||
|
|
||||||
|
//HERE impl. Client!?!? It reads from the socket to **result
|
||||||
static int
|
static int
|
||||||
nscd_gethst_r (const char *key, size_t keylen, request_type type,
|
nscd_gethst_r (const char *key, size_t keylen, request_type type,
|
||||||
struct hostent *resultbuf, char *buffer, size_t buflen,
|
struct hostent *resultbuf, char *buffer, size_t buflen,
|
||||||
|
@ -214,6 +215,7 @@ nscd_gethst_r (const char *key, size_t keylen, request_type type,
|
||||||
|
|
||||||
if (h_name == NULL)
|
if (h_name == NULL)
|
||||||
{
|
{
|
||||||
|
// Read here
|
||||||
sock = __nscd_open_socket (key, keylen, type, &hst_resp,
|
sock = __nscd_open_socket (key, keylen, type, &hst_resp,
|
||||||
sizeof (hst_resp));
|
sizeof (hst_resp));
|
||||||
if (sock == -1)
|
if (sock == -1)
|
||||||
|
|
|
@ -94,6 +94,7 @@ extern const char *hstrerror (int __err_num) __THROW;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// HERE: payload??? Nope, it's transformed
|
||||||
/* Description of data base entry for a single host. */
|
/* Description of data base entry for a single host. */
|
||||||
struct hostent
|
struct hostent
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue