Skip to content

Commit

Permalink
Some segv problems related to missing files
Browse files Browse the repository at this point in the history
Problems for not always picking up changes.
  • Loading branch information
halderen committed Feb 20, 2018
1 parent 0e871c0 commit 06e6af3
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
9 changes: 7 additions & 2 deletions httpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@ deletedelegation(names_view_type view, struct rpc *rpc)
/* delete everything below delegation point, inclusive */
names_iterator iter;
dictionary* record;
dictionary r;
for (iter = names_viewiterate(view, "allbelow", rpc->delegation_point); names_iterate(&iter, &record); names_advance(&iter, NULL)) {
names_recorddelall(*record, NULL);
r = *record;
names_own(view, &r);
names_recorddelall(r, NULL);
}
/* in case of error rpc->status = RPC_ERR; */
return 0;
Expand Down Expand Up @@ -101,7 +104,6 @@ insertrecords(names_view_type view, struct rpc *rpc)
free((void*)recorddata);
free((void*)recordinfo);
}
names_viewcommit(view);

rpc->status = RPC_OK;
return 0;
Expand All @@ -114,14 +116,17 @@ dispatch(struct httpd* httpd, struct rpc *rpc)
{
names_view_type view;
view = getzone(rpc->zone)->inputview;
names_viewreset(view);
switch (rpc->opc) {
case RPC_CHANGE_DELEGATION:
deletedelegation(view, rpc);
insertrecords(view, rpc);
names_viewcommit(view);
break;
case RPC_CHANGE_NAME:
deleterecordsets(view, rpc);
insertrecords(view, rpc);
names_viewcommit(view);
break;
default:
rpc->status = RPC_ERR;
Expand Down
4 changes: 2 additions & 2 deletions libtool
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Generated automatically by config.status (volans) 0.2-dev
# Libtool was configured on host fire:
# Libtool was configured on host nagini:
# NOTE: Changes made to this file will be lost: look at ltmain.sh.

# Provide generalized library-building support services.
Expand Down Expand Up @@ -285,7 +285,7 @@ hardcode_into_libs=yes
sys_lib_search_path_spec="/usr/lib64/gcc/x86_64-slackware-linux/7.3.0 /usr/lib64 /lib64 /usr/x86_64-slackware-linux/lib /lib /usr/lib "

# Detected run-time system search path for libraries.
sys_lib_dlsearch_path_spec="/lib /usr/lib /lib64 /usr/lib64 /usr/local/lib64 /usr/x86_64-slackware-linux/lib64 /usr/lib64/seamonkey "
sys_lib_dlsearch_path_spec="/lib /usr/lib /lib64 /usr/lib64 /usr/local/lib64 /usr/x86_64-slackware-linux/lib64 /usr/local/lib /usr/lib64/seamonkey "

# Explicit LT_SYS_LIBRARY_PATH set during ./configure time.
configure_time_lt_sys_library_path=""
Expand Down
9 changes: 1 addition & 8 deletions rpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@
struct rpc *
rpc_decode_json(const char *url, const char *buf, size_t buflen)
{
/*printf("incoming data: \"%s\"\n", buf);//not null terminated!*/

json_error_t error;
json_t *root = json_loadb(buf, buflen, 0, &error);
if (!root) {
Expand All @@ -80,11 +78,6 @@ rpc_decode_json(const char *url, const char *buf, size_t buflen)
return NULL;
}
json_t *obj_correlation = json_object_get(root, "transaction");
if (!obj_correlation || !json_is_string(obj_correlation)) {
printf("correlation not found.\n");
json_decref(root);
return NULL;
}

json_t *obj_entities = json_object_get(root, "entities");
if (!obj_entities || !json_is_array(obj_entities)) {
Expand Down Expand Up @@ -192,7 +185,7 @@ rpc_decode_json(const char *url, const char *buf, size_t buflen)
rpc->zone = strdup(zone);
rpc->version = strdup(version);
rpc->detail_version = strdup(json_string_value(obj_version));
rpc->correlation = strdup(json_string_value(obj_correlation));
rpc->correlation = (obj_correlation ? strdup(json_string_value(obj_correlation)) : NULL);
rpc->delegation_point = strdup(delegation_point);
rpc->rr_count = rr_count;
rpc->rr = rr;
Expand Down
4 changes: 4 additions & 0 deletions zoneinput.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ readzone(names_view_type view, enum operation_enum operation, const char* filena
ldns_rr* rr;

fp = fopen(filename,"r");
if(!fp) {
fprintf(stderr,"unable to open file \"%s\"\n",filename);
return -1;
}
origin = NULL;
prevowner = NULL;

Expand Down
3 changes: 3 additions & 0 deletions zoneoutput.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ writezone(names_view_type view, const char* filename, const char* apex, int* def

origin = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, apex);
fp = fopen(filename,"w");
if(!fp) {
fprintf(stderr,"unable to open file \"%s\"\n",filename);
}

s = ldns_rdf2str(origin);
fprintf(fp, "$ORIGIN %s\n", s);
Expand Down

0 comments on commit 06e6af3

Please sign in to comment.