Skip to content

Commit

Permalink
fix: support Nokogiri >= 1.13.7
Browse files Browse the repository at this point in the history
which changed the typed-data semantics around xmlNode in order to
fully support compaction

see sparklemotion/nokogiri#2579
  • Loading branch information
flavorjones committed Jul 13, 2022
1 parent a1bcc67 commit e8a49b0
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions ext/nokogiri_ext_xmlsec/common.h
Expand Up @@ -10,4 +10,6 @@

typedef int BOOL;

#define Noko_Node_Get_Struct(obj,type,sval) ((sval) = (type*)DATA_PTR(obj))

#endif // NOKOGIRI_EXT_XMLSEC_COMMON_H
2 changes: 1 addition & 1 deletion ext/nokogiri_ext_xmlsec/nokogiri_decrypt_with_key.c
Expand Up @@ -21,7 +21,7 @@ VALUE decrypt_with_key(VALUE self, VALUE rb_key_name, VALUE rb_key) {

Check_Type(rb_key, T_STRING);
Check_Type(rb_key_name, T_STRING);
Data_Get_Struct(self, xmlNode, node);
Noko_Node_Get_Struct(self, xmlNode, node);
key = RSTRING_PTR(rb_key);
keyLength = RSTRING_LEN(rb_key);
keyName = StringValueCStr(rb_key_name);
Expand Down
2 changes: 1 addition & 1 deletion ext/nokogiri_ext_xmlsec/nokogiri_encrypt_with_key.c
Expand Up @@ -53,7 +53,7 @@ VALUE encrypt_with_key(VALUE self, VALUE rb_rsa_key_name, VALUE rb_rsa_key,
goto done;
}

Data_Get_Struct(self, xmlNode, node);
Noko_Node_Get_Struct(self, xmlNode, node);
doc = node->doc;

// create encryption template to encrypt XML file and replace
Expand Down
4 changes: 2 additions & 2 deletions ext/nokogiri_ext_xmlsec/nokogiri_helpers_set_attribute_id.c
Expand Up @@ -17,7 +17,7 @@ VALUE set_id_attribute(VALUE self, VALUE rb_attr_name) {

resetXmlSecError();

Data_Get_Struct(self, xmlNode, node);
Noko_Node_Get_Struct(self, xmlNode, node);
Check_Type(rb_attr_name, T_STRING);
idName = StringValueCStr(rb_attr_name);

Expand Down Expand Up @@ -86,7 +86,7 @@ VALUE get_id(VALUE self, VALUE rb_id)
xmlDocPtr doc;

Check_Type(rb_id, T_STRING);
Data_Get_Struct(self, xmlDoc, doc);
Noko_Node_Get_Struct(self, xmlDoc, doc);
prop = xmlGetID(doc, (const xmlChar *)StringValueCStr(rb_id));
if (prop) {
return noko_xml_node_wrap(Qnil, (xmlNodePtr)prop);
Expand Down
2 changes: 1 addition & 1 deletion ext/nokogiri_ext_xmlsec/nokogiri_sign.c
Expand Up @@ -90,7 +90,7 @@ VALUE sign(VALUE self, VALUE rb_opts) {
goto done;
}

Data_Get_Struct(self, xmlNode, envelopeNode);
Noko_Node_Get_Struct(self, xmlNode, envelopeNode);
doc = envelopeNode->doc;
// create signature template for enveloped signature.
signNode = xmlSecTmplSignatureCreate(doc, xmlSecTransformExclC14NId,
Expand Down
2 changes: 1 addition & 1 deletion ext/nokogiri_ext_xmlsec/nokogiri_verify_with.c
Expand Up @@ -146,7 +146,7 @@ VALUE verify_with(VALUE self, VALUE rb_opts) {
resetXmlSecError();

Check_Type(rb_opts, T_HASH);
Data_Get_Struct(self, xmlNode, node);
Noko_Node_Get_Struct(self, xmlNode, node);

// verify start node
if(!xmlSecCheckNodeName(node, xmlSecNodeSignature, xmlSecDSigNs)) {
Expand Down

0 comments on commit e8a49b0

Please sign in to comment.