[DRE-commits] [ruby-password] 02/05: add newer-ruby.patch and password_crack.patch
Cédric Boutillier
boutil at alioth.debian.org
Thu Sep 26 13:40:46 UTC 2013
This is an automated email from the git hooks/post-receive script.
boutil pushed a commit to branch master
in repository ruby-password.
commit fc5d893047af3531794b1d6f4bd9855144645ce8
Author: Cédric Boutillier <boutil at debian.org>
Date: Thu Sep 26 15:24:07 2013 +0200
add newer-ruby.patch and password_crack.patch
---
debian/patches/newer-ruby.patch | 45 ++++++++++++++++++++++++++++++++
debian/patches/password_crack.patch | 48 +++++++++++++++++++++++++++++++++++
debian/patches/series | 2 ++
3 files changed, 95 insertions(+)
diff --git a/debian/patches/newer-ruby.patch b/debian/patches/newer-ruby.patch
new file mode 100644
index 0000000..c1437ae
--- /dev/null
+++ b/debian/patches/newer-ruby.patch
@@ -0,0 +1,45 @@
+Description: port to newer versions of Ruby
+ replace STR2CTR by StringValuePtr and change the way ASCII code of a character
+ is computed.
+Author: Cédric Boutillier <boutil at debian.org>
+Forwarded: no
+Last-Update: 2013-09-26
+
+--- a/rbcrack.c
++++ b/rbcrack.c
+@@ -59,12 +59,12 @@
+ /* pop the one and only argument we may have been passed */
+ dict = rb_ary_pop(args);
+
+- if (dict == Qnil || strcmp(STR2CSTR(dict), "") == 0) {
++ if (dict == Qnil || strcmp(StringValuePtr(dict), "") == 0) {
+ /* no argument passed, so use default location from rbcrack.h */
+ dict = rb_str_new2(CRACK_DICT);
+ } else {
+- buffer = malloc(strlen(STR2CSTR(dict)) + 8);
+- strcpy(buffer, STR2CSTR(dict));
++ buffer = malloc(strlen(StringValuePtr(dict)) + 8);
++ strcpy(buffer, StringValuePtr(dict));
+ strcat(buffer, ".pwd");
+
+ if (access(buffer, R_OK) != 0) {
+@@ -77,7 +77,7 @@
+ }
+
+ /* perform check on password */
+- objection = FascistCheck(STR2CSTR(self), STR2CSTR(dict));
++ objection = FascistCheck(StringValuePtr(self), StringValuePtr(dict));
+
+ /* return true on success; raise an exception otherwise */
+ if (objection) {
+--- a/lib/password.rb
++++ b/lib/password.rb
+@@ -327,7 +327,7 @@
+ if feature_flags.include? ONE_DIGIT
+
+ if ! first and rand( 10 ) < 3
+- pw << ( rand( 10 ) + ?0 ).chr
++ pw << ( rand( 10 ) + '0'.ord ).chr
+ feature_flags.delete ONE_DIGIT
+
+ first = true
diff --git a/debian/patches/password_crack.patch b/debian/patches/password_crack.patch
new file mode 100644
index 0000000..a9e2f57
--- /dev/null
+++ b/debian/patches/password_crack.patch
@@ -0,0 +1,48 @@
+Description: change the name of the C extension from crack to password_crack
+ This is to avoid conflict with crack.rb shipped by the ruby-crack package
+Author: Cédric Boutillier <boutil at debian.org>
+Forwarded: no
+Last-Update: 2013-09-26
+
+--- a/extconf.rb
++++ b/extconf.rb
+@@ -43,7 +43,7 @@
+
+ have_header('crack.h') && have_library('crack', 'FascistCheck') or exit 1
+
+-create_makefile('crack')
++create_makefile('password_crack')
+
+ File.open('Makefile', 'a') do |f|
+ f.print <<EOF
+@@ -54,7 +54,7 @@
+ docs:
+ -rdoc -x CVS rbcrack.c lib
+
+-test: crack.so FORCE
++test: password_crack.so FORCE
+ -cd test; ./tc_password.rb
+
+ FORCE:
+--- a/lib/password.rb
++++ b/lib/password.rb
+@@ -442,7 +442,7 @@
+ def check(dict=nil)
+ # Load the crack module (which injects a check method into this class,
+ # overriding this one) and try again.
+- self.send("check") if require 'crack'
++ self.send("check") if require 'password_crack'
+ end
+ end
+
+--- a/rbcrack.c
++++ b/rbcrack.c
+@@ -89,7 +89,7 @@
+ }
+
+ /* initialize this class */
+-void Init_crack()
++void Init_password_crack()
+ {
+ VALUE cPassword;
+
diff --git a/debian/patches/series b/debian/patches/series
index 5e155ef..417d055 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,3 @@
improvements-from-richard
+password_crack.patch
+newer-ruby.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-password.git
More information about the Pkg-ruby-extras-commits
mailing list