libmagic_rb 0.1.0.pre.alpha → 0.1.2.pre.alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +27 -11
- data/ext/libmagic/func.h +22 -14
- data/ext/libmagic/magic.c +16 -7
- data/ext/libmagic/modes.h +69 -4
- data/ext/libmagic/params.h +36 -2
- data/lib/libmagic_rb/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f83955d9acd36a5495fc5ebf8f58d8070d8b550346d5ee641169d40e44c8cd0
|
4
|
+
data.tar.gz: 49314dc7a8253aad8b2caea0813bcdc3836f35a5e11e95702225ea107d3dfede
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94d3eb21357bd71d31def537e0e5618332e0ece14d00fab580604bb3922fc8f960b573673d22f987ac2746fafae64dd746758eaebb0bf2e748df1bfb92917c19
|
7
|
+
data.tar.gz: 4d07b071dca014e47b4f658bd88a8add791eacce0aecfe61907353a1c16829ef7ec645ca936a9866e734ff976b64f2d544e20778de803522d70c9698a02aed65
|
data/README.md
CHANGED
@@ -3,21 +3,33 @@ Adds ability to check mime-type of a file using the libmagic ([magic(4)](https:/
|
|
3
3
|
It uses native extensions and it's quite performant.
|
4
4
|
|
5
5
|
## Pre-Installation
|
6
|
-
On Linux, you need to install libmagic.
|
6
|
+
On Linux, you need to install libmagic. The version we recommend is at least 5.36.
|
7
|
+
But if you have an older version of libmagic, it will compile and work flawlessly but with a few caveats:
|
7
8
|
|
8
|
-
|
9
|
+
+ Many constants (modes and params) will be not defined
|
10
|
+
+ LibmagicRb::MAGIC_VERSION constant will be set to 0.
|
11
|
+
+ Few methods will not work.
|
12
|
+
some methods that can return a String or Integer will return nil (like setparam and getparam).
|
13
|
+
|
14
|
+
[ Do note that the minimum tested version is 5.11, older than that may fail to compile the gem ]
|
15
|
+
|
16
|
+
You also need Ruby > 1.9.0 in order to run this gem.
|
17
|
+
|
18
|
+
With that info in mind, let's continue to the installation part for your Linux distributions...
|
19
|
+
|
20
|
+
#### Arch / Manjaro / Archlabs & other Arch based Linux
|
9
21
|
|
10
22
|
```
|
11
23
|
# pacman -S file gcc make
|
12
24
|
```
|
13
25
|
|
14
|
-
#### Debian / Ubuntu / Linux Mint /
|
26
|
+
#### Debian / Ubuntu / Linux Mint / RaspberryPi OS & other Debian based Linux
|
15
27
|
|
16
28
|
```
|
17
29
|
# apt install libmagic-dev ruby-dev gcc make
|
18
30
|
```
|
19
31
|
|
20
|
-
#### Fedora
|
32
|
+
#### Fedora / Amazon Linux / CentOS & Other RedHat based Linux
|
21
33
|
|
22
34
|
```
|
23
35
|
# yum install file-devel ruby-devel gcc make
|
@@ -51,6 +63,9 @@ Or install it yourself as:
|
|
51
63
|
$ gem install libmagic_rb
|
52
64
|
```
|
53
65
|
|
66
|
+
We recommend getting the gem only from Rubygems.org. Do not download this repo as zip, compile to install the gem.
|
67
|
+
A rubygem version is released after various tests. Any branch here including Master branch can be unstable can even segfault your app. You've been warned!
|
68
|
+
|
54
69
|
## Usage
|
55
70
|
The target of this gem is to add mime-type checking easily.
|
56
71
|
|
@@ -162,18 +177,19 @@ cookie.setparam(LibmagicRb::MAGIC_PARAM_REGEX_MAX, 2 ** 14) # => 16384; but can
|
|
162
177
|
|
163
178
|
#### Notes:
|
164
179
|
|
165
|
-
+ To get the parameters, you can refer to the [man page](https://man7.org/linux/man-pages/man3/magic_getflags.3.html).
|
166
|
-
+
|
180
|
+
+ To get the parameters, you can run `LibmagicRb.lsparams()` for description, please refer to the [man page](https://man7.org/linux/man-pages/man3/magic_getflags.3.html).
|
181
|
+
+ `cookie.setparam()` returns the value after getting the param as well. So you don't need to confirm by calling getparam() again.
|
167
182
|
+ The maximum size depends on the parameter. But the value that can be passed should not be more than 2 ** 32.
|
183
|
+
+ On older versions of libmagic, where the function isn't available, both getparam() and setparam() will perform no operations, and return nil!
|
168
184
|
|
169
185
|
## Errors
|
170
186
|
The following errors are implemented and raised on appropriate situation:
|
171
187
|
|
172
|
-
1. LibmagicRb::FileNotFound
|
173
|
-
2. LibmagicRb::FileUnreadable
|
174
|
-
3. LibmagicRb::InvalidDBError
|
175
|
-
4. LibmagicRb::IsDirError
|
176
|
-
5. LibmagicRb::FileClosedError
|
188
|
+
1. `LibmagicRb::FileNotFound`: When the file is not found.
|
189
|
+
2. `LibmagicRb::FileUnreadable`: When the file is unreadable.
|
190
|
+
3. `LibmagicRb::InvalidDBError`: When the database given is invalid.
|
191
|
+
4. `LibmagicRb::IsDirError`: When the database path is a directory.
|
192
|
+
5. `LibmagicRb::FileClosedError`: When the file is already closed (closed?()) but you are trying to access the cookie.
|
177
193
|
|
178
194
|
## Development
|
179
195
|
|
data/ext/libmagic/func.h
CHANGED
@@ -52,29 +52,37 @@ VALUE _checkGlobal_(volatile VALUE self) {
|
|
52
52
|
}
|
53
53
|
|
54
54
|
VALUE _getParamGlobal_(volatile VALUE self, volatile VALUE param) {
|
55
|
-
|
55
|
+
#if MAGIC_VERSION > 525
|
56
|
+
RB_UNWRAP(cookie) ;
|
56
57
|
|
57
|
-
|
58
|
-
|
58
|
+
unsigned int _param = NUM2UINT(param) ;
|
59
|
+
unsigned long value ;
|
59
60
|
|
60
|
-
|
61
|
-
|
62
|
-
|
61
|
+
int status = magic_getparam(*cookie, _param, &value) ;
|
62
|
+
if (status) return Qnil ;
|
63
|
+
return ULONG2NUM(value) ;
|
64
|
+
#else
|
65
|
+
return Qnil ;
|
66
|
+
#endif
|
63
67
|
}
|
64
68
|
|
65
69
|
VALUE _setParamGlobal_(volatile VALUE self, volatile VALUE param, volatile VALUE paramVal) {
|
66
|
-
|
67
|
-
|
70
|
+
#if MAGIC_VERSION > 525
|
71
|
+
unsigned int _param = NUM2UINT(param) ;
|
72
|
+
unsigned long _paramVal = NUM2ULONG(paramVal) ;
|
68
73
|
|
69
|
-
|
74
|
+
RB_UNWRAP(cookie) ;
|
70
75
|
|
71
|
-
|
72
|
-
|
76
|
+
unsigned long value ;
|
77
|
+
magic_setparam(*cookie, _param, &_paramVal) ;
|
73
78
|
|
74
|
-
|
79
|
+
int status = magic_getparam(*cookie, _param, &value) ;
|
80
|
+
if (status) return Qnil ;
|
75
81
|
|
76
|
-
|
77
|
-
|
82
|
+
return ULONG2NUM((int)value) ;
|
83
|
+
#else
|
84
|
+
return Qnil ;
|
85
|
+
#endif
|
78
86
|
}
|
79
87
|
|
80
88
|
VALUE _bufferGlobal_(volatile VALUE self, volatile VALUE string) {
|
data/ext/libmagic/magic.c
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#include <magic.h>
|
2
2
|
#include <stdio.h>
|
3
3
|
#include <unistd.h>
|
4
|
+
#include <sys/stat.h>
|
4
5
|
#include "ruby.h"
|
5
6
|
|
6
7
|
/*
|
@@ -10,6 +11,10 @@
|
|
10
11
|
#include "params.h"
|
11
12
|
#include "definitions.h"
|
12
13
|
|
14
|
+
#ifndef MAGIC_VERSION
|
15
|
+
#define MAGIC_VERSION 0
|
16
|
+
#endif
|
17
|
+
|
13
18
|
/*
|
14
19
|
* Errors
|
15
20
|
*/
|
@@ -39,7 +44,10 @@ static rb_data_type_t fileType = {
|
|
39
44
|
},
|
40
45
|
|
41
46
|
.data = NULL,
|
42
|
-
|
47
|
+
|
48
|
+
#ifdef RUBY_TYPED_FREE_IMMEDIATELY
|
49
|
+
.flags = RUBY_TYPED_FREE_IMMEDIATELY
|
50
|
+
#endif
|
43
51
|
} ;
|
44
52
|
|
45
53
|
#include "validations.h"
|
@@ -111,14 +119,11 @@ VALUE rb_libmagicRb_initialize(volatile VALUE self, volatile VALUE args) {
|
|
111
119
|
|
112
120
|
VALUE argDBPath = rb_hash_aref(args, ID2SYM(rb_intern("db"))) ;
|
113
121
|
|
114
|
-
char *databasePath ;
|
115
122
|
if (RB_TYPE_P(argDBPath, T_NIL)) {
|
116
|
-
databasePath = NULL ;
|
117
123
|
rb_ivar_set(self, rb_intern("@db"), Qnil) ;
|
118
124
|
} else if (!RB_TYPE_P(argDBPath, T_STRING)) {
|
119
125
|
rb_raise(rb_eArgError, "Database name must be an instance of String.") ;
|
120
126
|
} else {
|
121
|
-
databasePath = StringValuePtr(argDBPath) ;
|
122
127
|
rb_ivar_set(self, rb_intern("@db"), argDBPath) ;
|
123
128
|
}
|
124
129
|
|
@@ -183,9 +188,13 @@ void Init_main() {
|
|
183
188
|
modes(cLibmagicRb) ;
|
184
189
|
params(cLibmagicRb) ;
|
185
190
|
|
186
|
-
|
187
|
-
|
188
|
-
|
191
|
+
#if MAGIC_VERSION > 525
|
192
|
+
char version[6] ;
|
193
|
+
sprintf(version, "%0.2f", magic_version() / 100.0) ;
|
194
|
+
rb_define_const(cLibmagicRb, "MAGIC_VERSION", rb_str_new_cstr(version)) ;
|
195
|
+
#else
|
196
|
+
rb_define_const(cLibmagicRb, "MAGIC_VERSION", rb_str_new_cstr("0")) ;
|
197
|
+
#endif
|
189
198
|
|
190
199
|
/*
|
191
200
|
* Singleton Methods
|
data/ext/libmagic/modes.h
CHANGED
@@ -15,24 +15,57 @@ void modes(volatile VALUE rb_klass) {
|
|
15
15
|
rb_define_const(rb_klass, "MAGIC_RAW", INT2FIX(MAGIC_RAW)) ;
|
16
16
|
rb_define_const(rb_klass, "MAGIC_ERROR", INT2FIX(MAGIC_ERROR)) ;
|
17
17
|
rb_define_const(rb_klass, "MAGIC_APPLE", INT2FIX(MAGIC_APPLE)) ;
|
18
|
+
|
19
|
+
#ifdef MAGIC_EXTENSION
|
18
20
|
rb_define_const(rb_klass, "MAGIC_EXTENSION", INT2FIX(MAGIC_EXTENSION)) ;
|
21
|
+
#endif
|
22
|
+
|
23
|
+
#ifdef MAGIC_COMPRESS_TRANSP
|
19
24
|
rb_define_const(rb_klass, "MAGIC_COMPRESS_TRANSP", INT2FIX(MAGIC_COMPRESS_TRANSP)) ;
|
25
|
+
#endif
|
26
|
+
|
27
|
+
#ifdef MAGIC_NO_CHECK_APPTYPE
|
20
28
|
rb_define_const(rb_klass, "MAGIC_NO_CHECK_APPTYPE", INT2FIX(MAGIC_NO_CHECK_APPTYPE)) ;
|
29
|
+
#endif
|
30
|
+
|
31
|
+
#ifdef MAGIC_NO_CHECK_CDF
|
21
32
|
rb_define_const(rb_klass, "MAGIC_NO_CHECK_CDF", INT2FIX(MAGIC_NO_CHECK_CDF)) ;
|
33
|
+
#endif
|
34
|
+
|
35
|
+
#ifdef MAGIC_NO_CHECK_COMPRESS
|
22
36
|
rb_define_const(rb_klass, "MAGIC_NO_CHECK_COMPRESS", INT2FIX(MAGIC_NO_CHECK_COMPRESS)) ;
|
37
|
+
#endif
|
38
|
+
|
39
|
+
#ifdef MAGIC_NO_CHECK_ELF
|
23
40
|
rb_define_const(rb_klass, "MAGIC_NO_CHECK_ELF", INT2FIX(MAGIC_NO_CHECK_ELF)) ;
|
41
|
+
#endif
|
42
|
+
|
43
|
+
#ifdef MAGIC_NO_CHECK_ENCODING
|
24
44
|
rb_define_const(rb_klass, "MAGIC_NO_CHECK_ENCODING", INT2FIX(MAGIC_NO_CHECK_ENCODING)) ;
|
45
|
+
#endif
|
46
|
+
|
47
|
+
#ifdef MAGIC_NO_CHECK_SOFT
|
25
48
|
rb_define_const(rb_klass, "MAGIC_NO_CHECK_SOFT", INT2FIX(MAGIC_NO_CHECK_SOFT)) ;
|
49
|
+
#endif
|
50
|
+
|
51
|
+
#ifdef MAGIC_NO_CHECK_TAR
|
26
52
|
rb_define_const(rb_klass, "MAGIC_NO_CHECK_TAR", INT2FIX(MAGIC_NO_CHECK_TAR)) ;
|
53
|
+
#endif
|
54
|
+
|
55
|
+
#ifdef MAGIC_NO_CHECK_TEXT
|
27
56
|
rb_define_const(rb_klass, "MAGIC_NO_CHECK_TEXT", INT2FIX(MAGIC_NO_CHECK_TEXT)) ;
|
57
|
+
#endif
|
58
|
+
|
59
|
+
#ifdef MAGIC_NO_CHECK_TOKENS
|
28
60
|
rb_define_const(rb_klass, "MAGIC_NO_CHECK_TOKENS", INT2FIX(MAGIC_NO_CHECK_TOKENS)) ;
|
61
|
+
#endif
|
29
62
|
|
30
63
|
#ifdef MAGIC_NO_CHECK_JSON
|
31
|
-
|
64
|
+
rb_define_const(rb_klass, "MAGIC_NO_CHECK_JSON", INT2FIX(MAGIC_NO_CHECK_JSON)) ;
|
32
65
|
#endif
|
33
66
|
|
34
67
|
#ifdef MAGIC_NO_CHECK_CSV
|
35
|
-
|
68
|
+
rb_define_const(rb_klass, "MAGIC_NO_CHECK_CSV", INT2FIX(MAGIC_NO_CHECK_CSV)) ;
|
36
69
|
#endif
|
37
70
|
}
|
38
71
|
|
@@ -53,24 +86,56 @@ VALUE lsmodes(volatile VALUE obj) {
|
|
53
86
|
rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_RAW")), INT2FIX(MAGIC_RAW)) ;
|
54
87
|
rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_ERROR")), INT2FIX(MAGIC_ERROR)) ;
|
55
88
|
rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_APPLE")), INT2FIX(MAGIC_APPLE)) ;
|
89
|
+
#ifdef MAGIC_EXTENSION
|
56
90
|
rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_EXTENSION")), INT2FIX(MAGIC_EXTENSION)) ;
|
91
|
+
#endif
|
92
|
+
|
93
|
+
#ifdef MAGIC_COMPRESS_TRANSP
|
57
94
|
rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_COMPRESS_TRANSP")), INT2FIX(MAGIC_COMPRESS_TRANSP)) ;
|
95
|
+
#endif
|
96
|
+
|
97
|
+
#ifdef MAGIC_NO_CHECK_APPTYPE
|
58
98
|
rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_APPTYPE")), INT2FIX(MAGIC_NO_CHECK_APPTYPE)) ;
|
99
|
+
#endif
|
100
|
+
|
101
|
+
#ifdef MAGIC_NO_CHECK_CDF
|
59
102
|
rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_CDF")), INT2FIX(MAGIC_NO_CHECK_CDF)) ;
|
103
|
+
#endif
|
104
|
+
|
105
|
+
#ifdef MAGIC_NO_CHECK_COMPRESS
|
60
106
|
rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_COMPRESS")), INT2FIX(MAGIC_NO_CHECK_COMPRESS)) ;
|
107
|
+
#endif
|
108
|
+
|
109
|
+
#ifdef MAGIC_NO_CHECK_ELF
|
61
110
|
rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_ELF")), INT2FIX(MAGIC_NO_CHECK_ELF)) ;
|
111
|
+
#endif
|
112
|
+
|
113
|
+
#ifdef MAGIC_NO_CHECK_ENCODING
|
62
114
|
rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_ENCODING")), INT2FIX(MAGIC_NO_CHECK_ENCODING)) ;
|
115
|
+
#endif
|
116
|
+
|
117
|
+
#ifdef MAGIC_NO_CHECK_SOFT
|
63
118
|
rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_SOFT")), INT2FIX(MAGIC_NO_CHECK_SOFT)) ;
|
119
|
+
#endif
|
120
|
+
|
121
|
+
#ifdef MAGIC_NO_CHECK_TAR
|
64
122
|
rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_TAR")), INT2FIX(MAGIC_NO_CHECK_TAR)) ;
|
123
|
+
#endif
|
124
|
+
|
125
|
+
#ifdef MAGIC_NO_CHECK_TEXT
|
65
126
|
rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_TEXT")), INT2FIX(MAGIC_NO_CHECK_TEXT)) ;
|
127
|
+
#endif
|
128
|
+
|
129
|
+
#ifdef MAGIC_NO_CHECK_TOKENS
|
66
130
|
rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_TOKENS")), INT2FIX(MAGIC_NO_CHECK_TOKENS)) ;
|
131
|
+
#endif
|
67
132
|
|
68
133
|
#ifdef MAGIC_NO_CHECK_CSV
|
69
|
-
|
134
|
+
rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_CSV")), INT2FIX(MAGIC_NO_CHECK_CSV)) ;
|
70
135
|
#endif
|
71
136
|
|
72
137
|
#ifdef MAGIC_NO_CHECK_CSV
|
73
|
-
|
138
|
+
rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_JSON")), INT2FIX(MAGIC_NO_CHECK_JSON)) ;
|
74
139
|
#endif
|
75
140
|
|
76
141
|
return hash ;
|
data/ext/libmagic/params.h
CHANGED
@@ -1,28 +1,62 @@
|
|
1
1
|
void params(volatile VALUE rb_klass) {
|
2
|
+
#ifdef MAGIC_PARAM_INDIR_MAX
|
2
3
|
rb_define_const(rb_klass, "MAGIC_PARAM_INDIR_MAX", UINT2NUM(MAGIC_PARAM_INDIR_MAX)) ;
|
4
|
+
#endif
|
5
|
+
|
6
|
+
#ifdef MAGIC_PARAM_NAME_MAX
|
3
7
|
rb_define_const(rb_klass, "MAGIC_PARAM_NAME_MAX", UINT2NUM(MAGIC_PARAM_NAME_MAX)) ;
|
8
|
+
#endif
|
9
|
+
|
10
|
+
#ifdef MAGIC_PARAM_ELF_NOTES_MAX
|
4
11
|
rb_define_const(rb_klass, "MAGIC_PARAM_ELF_NOTES_MAX", UINT2NUM(MAGIC_PARAM_ELF_NOTES_MAX)) ;
|
12
|
+
#endif
|
13
|
+
|
14
|
+
#ifdef MAGIC_PARAM_ELF_PHNUM_MAX
|
5
15
|
rb_define_const(rb_klass, "MAGIC_PARAM_ELF_PHNUM_MAX", UINT2NUM(MAGIC_PARAM_ELF_PHNUM_MAX)) ;
|
16
|
+
#endif
|
17
|
+
|
18
|
+
#ifdef MAGIC_PARAM_ELF_SHNUM_MAX
|
6
19
|
rb_define_const(rb_klass, "MAGIC_PARAM_ELF_SHNUM_MAX", UINT2NUM(MAGIC_PARAM_ELF_SHNUM_MAX)) ;
|
20
|
+
#endif
|
21
|
+
|
22
|
+
#ifdef MAGIC_PARAM_REGEX_MAX
|
7
23
|
rb_define_const(rb_klass, "MAGIC_PARAM_REGEX_MAX", UINT2NUM(MAGIC_PARAM_REGEX_MAX)) ;
|
24
|
+
#endif
|
8
25
|
|
9
26
|
#ifdef MAGIC_PARAM_BYTES_MAX
|
10
|
-
|
27
|
+
rb_define_const(rb_klass, "MAGIC_PARAM_BYTES_MAX", UINT2NUM(MAGIC_PARAM_BYTES_MAX)) ;
|
11
28
|
#endif
|
12
29
|
}
|
13
30
|
|
14
31
|
VALUE lsparams(volatile VALUE obj) {
|
15
32
|
VALUE hash = rb_hash_new() ;
|
16
33
|
|
34
|
+
#ifdef MAGIC_PARAM_INDIR_MAX
|
17
35
|
rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_PARAM_INDIR_MAX")), UINT2NUM(MAGIC_PARAM_INDIR_MAX)) ;
|
36
|
+
#endif
|
37
|
+
|
38
|
+
#ifdef MAGIC_PARAM_NAME_MAX
|
18
39
|
rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_PARAM_NAME_MAX")), UINT2NUM(MAGIC_PARAM_NAME_MAX)) ;
|
40
|
+
#endif
|
41
|
+
|
42
|
+
#ifdef MAGIC_PARAM_ELF_NOTES_MAX
|
19
43
|
rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_PARAM_ELF_NOTES_MAX")), UINT2NUM(MAGIC_PARAM_ELF_NOTES_MAX)) ;
|
44
|
+
#endif
|
45
|
+
|
46
|
+
#ifdef MAGIC_PARAM_ELF_PHNUM_MAX
|
20
47
|
rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_PARAM_ELF_PHNUM_MAX")), UINT2NUM(MAGIC_PARAM_ELF_PHNUM_MAX)) ;
|
48
|
+
#endif
|
49
|
+
|
50
|
+
#ifdef MAGIC_PARAM_ELF_SHNUM_MAX
|
21
51
|
rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_PARAM_ELF_SHNUM_MAX")), UINT2NUM(MAGIC_PARAM_ELF_SHNUM_MAX)) ;
|
52
|
+
#endif
|
53
|
+
|
54
|
+
#ifdef MAGIC_PARAM_REGEX_MAX
|
22
55
|
rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_PARAM_REGEX_MAX")), UINT2NUM(MAGIC_PARAM_REGEX_MAX)) ;
|
56
|
+
#endif
|
23
57
|
|
24
58
|
#ifdef MAGIC_PARAM_BYTES_MAX
|
25
|
-
|
59
|
+
rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_PARAM_BYTES_MAX")), UINT2NUM(MAGIC_PARAM_BYTES_MAX)) ;
|
26
60
|
#endif
|
27
61
|
|
28
62
|
return hash ;
|
data/lib/libmagic_rb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libmagic_rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2.pre.alpha
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cybergizer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Check filetype with libmagic
|
14
14
|
email:
|
@@ -32,7 +32,7 @@ files:
|
|
32
32
|
- ext/libmagic/validations.h
|
33
33
|
- lib/libmagic_rb.rb
|
34
34
|
- lib/libmagic_rb/version.rb
|
35
|
-
homepage: https://github.com/
|
35
|
+
homepage: https://github.com/cybergizer-hq/LibmagicRb/
|
36
36
|
licenses:
|
37
37
|
- MIT
|
38
38
|
metadata: {}
|
@@ -51,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: 1.3.1
|
53
53
|
requirements: []
|
54
|
-
rubygems_version: 3.
|
54
|
+
rubygems_version: 3.2.21
|
55
55
|
signing_key:
|
56
56
|
specification_version: 4
|
57
57
|
summary: Check filetype with libmagic
|