rugged 0.21.0 → 0.21.1b0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -5
- data/ext/rugged/extconf.rb +8 -8
- data/ext/rugged/rugged.h +1 -1
- data/ext/rugged/rugged_cred.c +23 -0
- data/ext/rugged/rugged_index.c +5 -1
- data/ext/rugged/rugged_remote.c +68 -0
- data/ext/rugged/rugged_repo.c +287 -5
- data/ext/rugged/rugged_tag_collection.c +70 -2
- data/ext/rugged/rugged_tree.c +29 -10
- data/lib/rugged.rb +1 -0
- data/lib/rugged/attributes.rb +41 -0
- data/lib/rugged/diff.rb +0 -1
- data/lib/rugged/diff/line.rb +1 -3
- data/lib/rugged/patch.rb +12 -2
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +11 -0
- data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +324 -0
- data/vendor/libgit2/deps/http-parser/http_parser.h +2 -0
- data/vendor/libgit2/deps/zlib/adler32.c +39 -29
- data/vendor/libgit2/deps/zlib/crc32.c +33 -50
- data/vendor/libgit2/deps/zlib/crc32.h +1 -1
- data/vendor/libgit2/deps/zlib/deflate.c +198 -65
- data/vendor/libgit2/deps/zlib/deflate.h +8 -4
- data/vendor/libgit2/deps/zlib/infback.c +640 -0
- data/vendor/libgit2/deps/zlib/inffast.c +3 -3
- data/vendor/libgit2/deps/zlib/inffixed.h +3 -3
- data/vendor/libgit2/deps/zlib/inflate.c +84 -52
- data/vendor/libgit2/deps/zlib/inftrees.c +15 -39
- data/vendor/libgit2/deps/zlib/trees.c +18 -36
- data/vendor/libgit2/deps/zlib/zconf.h +4 -0
- data/vendor/libgit2/deps/zlib/zlib.h +250 -95
- data/vendor/libgit2/deps/zlib/zutil.c +13 -10
- data/vendor/libgit2/deps/zlib/zutil.h +41 -62
- data/vendor/libgit2/include/git2/attr.h +16 -13
- data/vendor/libgit2/include/git2/buffer.h +16 -0
- data/vendor/libgit2/include/git2/checkout.h +12 -12
- data/vendor/libgit2/include/git2/cherrypick.h +15 -15
- data/vendor/libgit2/include/git2/clone.h +77 -69
- data/vendor/libgit2/include/git2/diff.h +7 -0
- data/vendor/libgit2/include/git2/errors.h +1 -0
- data/vendor/libgit2/include/git2/merge.h +16 -0
- data/vendor/libgit2/include/git2/oid.h +8 -4
- data/vendor/libgit2/include/git2/oidarray.h +40 -0
- data/vendor/libgit2/include/git2/remote.h +5 -24
- data/vendor/libgit2/include/git2/repository.h +4 -1
- data/vendor/libgit2/include/git2/reset.h +4 -0
- data/vendor/libgit2/include/git2/status.h +17 -14
- data/vendor/libgit2/include/git2/submodule.h +18 -0
- data/vendor/libgit2/include/git2/sys/transport.h +354 -0
- data/vendor/libgit2/include/git2/transport.h +34 -327
- data/vendor/libgit2/include/git2/types.h +16 -6
- data/vendor/libgit2/src/array.h +1 -1
- data/vendor/libgit2/src/attr_file.c +14 -1
- data/vendor/libgit2/src/blame.c +0 -1
- data/vendor/libgit2/src/buffer.c +67 -10
- data/vendor/libgit2/src/buffer.h +4 -2
- data/vendor/libgit2/src/cache.c +9 -9
- data/vendor/libgit2/src/cache.h +1 -1
- data/vendor/libgit2/src/checkout.c +118 -23
- data/vendor/libgit2/src/cherrypick.c +41 -44
- data/vendor/libgit2/src/clone.c +94 -56
- data/vendor/libgit2/src/config_file.c +4 -4
- data/vendor/libgit2/src/diff.c +21 -0
- data/vendor/libgit2/src/diff_file.c +1 -0
- data/vendor/libgit2/src/diff_print.c +11 -9
- data/vendor/libgit2/src/diff_tform.c +3 -1
- data/vendor/libgit2/src/errors.c +9 -7
- data/vendor/libgit2/src/fileops.c +5 -3
- data/vendor/libgit2/src/global.c +9 -1
- data/vendor/libgit2/src/global.h +1 -0
- data/vendor/libgit2/src/graph.c +2 -2
- data/vendor/libgit2/src/indexer.c +6 -1
- data/vendor/libgit2/src/merge.c +98 -144
- data/vendor/libgit2/src/merge.h +1 -1
- data/vendor/libgit2/src/netops.c +4 -0
- data/vendor/libgit2/src/oid.c +8 -0
- data/vendor/libgit2/src/oid.h +11 -0
- data/vendor/libgit2/src/oidarray.c +21 -0
- data/vendor/libgit2/src/oidarray.h +18 -0
- data/vendor/libgit2/src/pack.c +1 -4
- data/vendor/libgit2/src/path.c +93 -33
- data/vendor/libgit2/src/path.h +21 -0
- data/vendor/libgit2/src/pool.c +1 -1
- data/vendor/libgit2/src/posix.h +46 -28
- data/vendor/libgit2/src/refs.h +2 -2
- data/vendor/libgit2/src/refspec.c +54 -18
- data/vendor/libgit2/src/remote.c +31 -8
- data/vendor/libgit2/src/remote.h +3 -0
- data/vendor/libgit2/src/repository.c +27 -11
- data/vendor/libgit2/src/revert.c +4 -6
- data/vendor/libgit2/src/revparse.c +15 -18
- data/vendor/libgit2/src/revwalk.c +0 -3
- data/vendor/libgit2/src/signature.c +2 -2
- data/vendor/libgit2/src/stash.c +2 -1
- data/vendor/libgit2/src/status.c +11 -2
- data/vendor/libgit2/src/strnlen.h +2 -1
- data/vendor/libgit2/src/submodule.c +73 -33
- data/vendor/libgit2/src/thread-utils.h +0 -7
- data/vendor/libgit2/src/trace.h +9 -1
- data/vendor/libgit2/src/transport.c +93 -90
- data/vendor/libgit2/src/transports/auth.c +71 -0
- data/vendor/libgit2/src/transports/auth.h +63 -0
- data/vendor/libgit2/src/transports/auth_negotiate.c +275 -0
- data/vendor/libgit2/src/transports/auth_negotiate.h +27 -0
- data/vendor/libgit2/src/transports/cred.c +58 -0
- data/vendor/libgit2/src/transports/cred.h +14 -0
- data/vendor/libgit2/src/transports/cred_helpers.c +3 -0
- data/vendor/libgit2/src/transports/git.c +1 -0
- data/vendor/libgit2/src/transports/http.c +168 -76
- data/vendor/libgit2/src/transports/smart.h +1 -0
- data/vendor/libgit2/src/transports/smart_protocol.c +4 -2
- data/vendor/libgit2/src/transports/ssh.c +214 -38
- data/vendor/libgit2/src/transports/winhttp.c +26 -6
- data/vendor/libgit2/src/unix/posix.h +23 -9
- data/vendor/libgit2/src/unix/realpath.c +8 -7
- data/vendor/libgit2/src/util.c +2 -1
- data/vendor/libgit2/src/util.h +3 -3
- data/vendor/libgit2/src/win32/mingw-compat.h +5 -12
- data/vendor/libgit2/src/win32/msvc-compat.h +3 -32
- data/vendor/libgit2/src/win32/posix.h +20 -31
- data/vendor/libgit2/src/win32/posix_w32.c +33 -4
- metadata +81 -69
@@ -177,6 +177,73 @@ static VALUE rb_git_tag_collection_create(int argc, VALUE *argv, VALUE self)
|
|
177
177
|
return rb_git_tag_collection_aref(self, rb_name);
|
178
178
|
}
|
179
179
|
|
180
|
+
/*
|
181
|
+
* call-seq:
|
182
|
+
* tags.create_annotation(name, target, annotation) -> annotation
|
183
|
+
*
|
184
|
+
* Create a new annotated tag object with the specified +name+ on +target+ in
|
185
|
+
* +repo+.
|
186
|
+
*
|
187
|
+
* Unlike the +create+ method, +create_annotation+ simply creates a tag
|
188
|
+
* object. It does not write a tag ref.
|
189
|
+
*
|
190
|
+
* +annotation+ must have the following keys:
|
191
|
+
*
|
192
|
+
* :tagger ::
|
193
|
+
* An optional Hash containing a git signature. Defaults to the signature
|
194
|
+
* from the configuration if only `:message` is given. Will cause the
|
195
|
+
* creation of an annotated tag object if present.
|
196
|
+
*
|
197
|
+
* :message ::
|
198
|
+
* An optional string containing the message for the new tag.
|
199
|
+
*
|
200
|
+
* Returns an instance of Rugged::Tag::Annotation representing the newly
|
201
|
+
* created annotation.
|
202
|
+
*/
|
203
|
+
static VALUE rb_git_tag_collection_create_annotation(VALUE self, VALUE rb_name, VALUE rb_target, VALUE rb_annotation)
|
204
|
+
{
|
205
|
+
git_oid tag_oid;
|
206
|
+
git_repository *repo = NULL;
|
207
|
+
git_object *target = NULL, *tag = NULL;
|
208
|
+
git_signature *tagger = NULL;
|
209
|
+
VALUE rb_message;
|
210
|
+
int error;
|
211
|
+
|
212
|
+
VALUE rb_repo = rugged_owner(self);
|
213
|
+
rugged_check_repo(rb_repo);
|
214
|
+
Data_Get_Struct(rb_repo, git_repository, repo);
|
215
|
+
|
216
|
+
Check_Type(rb_name, T_STRING);
|
217
|
+
|
218
|
+
target = rugged_object_get(repo, rb_target, GIT_OBJ_ANY);
|
219
|
+
|
220
|
+
rb_message = rb_hash_aref(rb_annotation, CSTR2SYM("message"));
|
221
|
+
Check_Type(rb_message, T_STRING);
|
222
|
+
|
223
|
+
tagger = rugged_signature_get(
|
224
|
+
rb_hash_aref(rb_annotation, CSTR2SYM("tagger")), repo
|
225
|
+
);
|
226
|
+
|
227
|
+
error = git_tag_annotation_create(
|
228
|
+
&tag_oid,
|
229
|
+
repo,
|
230
|
+
StringValueCStr(rb_name),
|
231
|
+
target,
|
232
|
+
tagger,
|
233
|
+
StringValueCStr(rb_message)
|
234
|
+
);
|
235
|
+
|
236
|
+
git_object_free(target);
|
237
|
+
git_signature_free(tagger);
|
238
|
+
|
239
|
+
rugged_exception_check(error);
|
240
|
+
|
241
|
+
error = git_object_lookup(&tag, repo, &tag_oid, GIT_OBJ_TAG);
|
242
|
+
rugged_exception_check(error);
|
243
|
+
|
244
|
+
return rugged_object_new(rb_repo, tag);
|
245
|
+
}
|
246
|
+
|
180
247
|
static VALUE each_tag(int argc, VALUE *argv, VALUE self, int tag_names_only)
|
181
248
|
{
|
182
249
|
git_repository *repo;
|
@@ -269,8 +336,9 @@ void Init_rugged_tag_collection(void)
|
|
269
336
|
|
270
337
|
rb_define_method(rb_cRuggedTagCollection, "initialize", rb_git_tag_collection_initialize, 1);
|
271
338
|
|
272
|
-
rb_define_method(rb_cRuggedTagCollection, "create",
|
273
|
-
rb_define_method(rb_cRuggedTagCollection, "
|
339
|
+
rb_define_method(rb_cRuggedTagCollection, "create", rb_git_tag_collection_create, -1);
|
340
|
+
rb_define_method(rb_cRuggedTagCollection, "create_annotation", rb_git_tag_collection_create_annotation, 3);
|
341
|
+
rb_define_method(rb_cRuggedTagCollection, "[]", rb_git_tag_collection_aref, 1);
|
274
342
|
|
275
343
|
rb_define_method(rb_cRuggedTagCollection, "each", rb_git_tag_collection_each, -1);
|
276
344
|
rb_define_method(rb_cRuggedTagCollection, "each_name", rb_git_tag_collection_each_name, -1);
|
data/ext/rugged/rugged_tree.c
CHANGED
@@ -188,14 +188,26 @@ static VALUE rb_git_tree_each(VALUE self)
|
|
188
188
|
return Qnil;
|
189
189
|
}
|
190
190
|
|
191
|
-
static int rugged__treewalk_cb(const char *root, const git_tree_entry *entry, void *
|
191
|
+
static int rugged__treewalk_cb(const char *root, const git_tree_entry *entry, void *payload)
|
192
192
|
{
|
193
|
-
|
194
|
-
rb_str_new_utf8(root),
|
195
|
-
rb_git_treeentry_fromC(entry)
|
196
|
-
);
|
193
|
+
int *exception = (int *)payload;
|
197
194
|
|
198
|
-
|
195
|
+
VALUE rb_result, rb_args = rb_ary_new2(2);
|
196
|
+
|
197
|
+
rb_ary_push(rb_args, rb_str_new_utf8(root));
|
198
|
+
rb_ary_push(rb_args, rb_git_treeentry_fromC(entry));
|
199
|
+
|
200
|
+
rb_result = rb_protect(rb_yield_splat, rb_args, exception);
|
201
|
+
|
202
|
+
if (*exception)
|
203
|
+
return -1;
|
204
|
+
|
205
|
+
/* skip entry when 'false' is returned */
|
206
|
+
if (TYPE(rb_result) == T_FALSE)
|
207
|
+
return 1;
|
208
|
+
|
209
|
+
/* otherwise continue normal iteration */
|
210
|
+
return 0;
|
199
211
|
}
|
200
212
|
|
201
213
|
/*
|
@@ -208,6 +220,9 @@ static int rugged__treewalk_cb(const char *root, const git_tree_entry *entry, vo
|
|
208
220
|
* also takes a +root+, the relative path in the traversal, starting from the root
|
209
221
|
* of the original tree.
|
210
222
|
*
|
223
|
+
* If the +block+ returns a falsy value, that entry and its sub-entries (in the case
|
224
|
+
* of a folder) will be skipped for the iteration.
|
225
|
+
*
|
211
226
|
* If no +block+ is given, an +Iterator+ is returned instead.
|
212
227
|
*
|
213
228
|
* tree.walk(:postorder) { |root, entry| puts "#{root}#{entry[:name]} [#{entry[:oid]}]" }
|
@@ -223,7 +238,7 @@ static int rugged__treewalk_cb(const char *root, const git_tree_entry *entry, vo
|
|
223
238
|
static VALUE rb_git_tree_walk(VALUE self, VALUE rb_mode)
|
224
239
|
{
|
225
240
|
git_tree *tree;
|
226
|
-
int error, mode = 0;
|
241
|
+
int error, mode = 0, exception = 0;
|
227
242
|
ID id_mode;
|
228
243
|
|
229
244
|
Data_Get_Struct(self, git_tree, tree);
|
@@ -242,7 +257,11 @@ static VALUE rb_git_tree_walk(VALUE self, VALUE rb_mode)
|
|
242
257
|
rb_raise(rb_eTypeError,
|
243
258
|
"Invalid iteration mode. Expected `:preorder` or `:postorder`");
|
244
259
|
|
245
|
-
error = git_tree_walk(tree, mode, &rugged__treewalk_cb, (void *)
|
260
|
+
error = git_tree_walk(tree, mode, &rugged__treewalk_cb, (void *)&exception);
|
261
|
+
|
262
|
+
if (exception)
|
263
|
+
rb_jump_tag(exception);
|
264
|
+
|
246
265
|
rugged_exception_check(error);
|
247
266
|
|
248
267
|
return Qnil;
|
@@ -454,7 +473,7 @@ static VALUE rb_git_tree_diff_(int argc, VALUE *argv, VALUE self)
|
|
454
473
|
xfree(opts.pathspec.strings);
|
455
474
|
rugged_exception_check(error);
|
456
475
|
|
457
|
-
return rugged_diff_new(rb_cRuggedDiff,
|
476
|
+
return rugged_diff_new(rb_cRuggedDiff, rb_repo, diff);
|
458
477
|
}
|
459
478
|
|
460
479
|
/*
|
@@ -489,7 +508,7 @@ static VALUE rb_git_tree_diff_workdir(int argc, VALUE *argv, VALUE self)
|
|
489
508
|
xfree(opts.pathspec.strings);
|
490
509
|
rugged_exception_check(error);
|
491
510
|
|
492
|
-
return rugged_diff_new(rb_cRuggedDiff,
|
511
|
+
return rugged_diff_new(rb_cRuggedDiff, owner, diff);
|
493
512
|
}
|
494
513
|
|
495
514
|
void rugged_parse_merge_options(git_merge_options *opts, VALUE rb_options)
|
data/lib/rugged.rb
CHANGED
@@ -0,0 +1,41 @@
|
|
1
|
+
module Rugged
|
2
|
+
class Repository
|
3
|
+
def attributes(path, options = {})
|
4
|
+
Attributes.new(self, path, options)
|
5
|
+
end
|
6
|
+
|
7
|
+
class Attributes
|
8
|
+
include Enumerable
|
9
|
+
|
10
|
+
LOAD_PRIORITIES = {
|
11
|
+
[:file, :index] => 0,
|
12
|
+
[:index, :file] => 1,
|
13
|
+
[:index] => 2,
|
14
|
+
}
|
15
|
+
|
16
|
+
def self.parse_opts(opt)
|
17
|
+
flags = LOAD_PRIORITIES[opt[:priority]] || 0
|
18
|
+
flags |= 4 if opt[:skip_system]
|
19
|
+
flags
|
20
|
+
end
|
21
|
+
|
22
|
+
def initialize(repository, path, options = {})
|
23
|
+
@repository = repository
|
24
|
+
@path = path
|
25
|
+
@load_flags = Attributes.parse_opts(options)
|
26
|
+
end
|
27
|
+
|
28
|
+
def [](attribute)
|
29
|
+
@repository.fetch_attributes(@path, attribute, @load_flags)
|
30
|
+
end
|
31
|
+
|
32
|
+
def to_h
|
33
|
+
@hash ||= @repository.fetch_attributes(@path, nil, @load_flags)
|
34
|
+
end
|
35
|
+
|
36
|
+
def each(&block)
|
37
|
+
to_h.each(&block)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/lib/rugged/diff.rb
CHANGED
data/lib/rugged/diff/line.rb
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
module Rugged
|
2
2
|
class Diff
|
3
3
|
class Line
|
4
|
-
attr_reader :line_origin, :content, :
|
5
|
-
|
6
|
-
alias hunk owner
|
4
|
+
attr_reader :line_origin, :content, :old_lineno, :new_lineno, :content_offset
|
7
5
|
|
8
6
|
def context?
|
9
7
|
@line_origin == :context
|
data/lib/rugged/patch.rb
CHANGED
@@ -13,9 +13,19 @@ module Rugged
|
|
13
13
|
"#<#{self.class.name}:#{object_id}>"
|
14
14
|
end
|
15
15
|
|
16
|
-
# Returns the number of
|
16
|
+
# Returns the number of additions in the patch.
|
17
|
+
def additions
|
18
|
+
stat[0]
|
19
|
+
end
|
20
|
+
|
21
|
+
# Returns the number of deletions in the patch.
|
22
|
+
def deletions
|
23
|
+
stat[1]
|
24
|
+
end
|
25
|
+
|
26
|
+
# Returns the number of total changes in the patch.
|
17
27
|
def changes
|
18
|
-
|
28
|
+
additions + deletions
|
19
29
|
end
|
20
30
|
|
21
31
|
# Returns an Array containing all hunks of the patch.
|
data/lib/rugged/version.rb
CHANGED
@@ -36,6 +36,7 @@ OPTION( ANDROID "Build for android NDK" OFF )
|
|
36
36
|
|
37
37
|
OPTION( USE_ICONV "Link with and use iconv library" OFF )
|
38
38
|
OPTION( USE_SSH "Link with libssh to enable SSH support" ON )
|
39
|
+
OPTION( USE_GSSAPI "Link with libgssapi for SPNEGO auth" OFF )
|
39
40
|
OPTION( VALGRIND "Configure build for valgrind" OFF )
|
40
41
|
|
41
42
|
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
@@ -208,6 +209,14 @@ IF (LIBSSH2_FOUND)
|
|
208
209
|
SET(SSH_LIBRARIES ${LIBSSH2_LIBRARIES})
|
209
210
|
ENDIF()
|
210
211
|
|
212
|
+
# Optional external dependency: libgssapi
|
213
|
+
IF (USE_GSSAPI)
|
214
|
+
FIND_PACKAGE(GSSAPI)
|
215
|
+
ENDIF()
|
216
|
+
IF (GSSAPI_FOUND)
|
217
|
+
ADD_DEFINITIONS(-DGIT_GSSAPI)
|
218
|
+
ENDIF()
|
219
|
+
|
211
220
|
# Optional external dependency: iconv
|
212
221
|
IF (USE_ICONV)
|
213
222
|
FIND_PACKAGE(Iconv)
|
@@ -387,6 +396,7 @@ ENDIF()
|
|
387
396
|
ADD_LIBRARY(git2 ${SRC_H} ${SRC_GIT2} ${SRC_OS} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_REGEX} ${SRC_SHA1} ${WIN_RC})
|
388
397
|
TARGET_LINK_LIBRARIES(git2 ${SSL_LIBRARIES})
|
389
398
|
TARGET_LINK_LIBRARIES(git2 ${SSH_LIBRARIES})
|
399
|
+
TARGET_LINK_LIBRARIES(git2 ${GSSAPI_LIBRARIES})
|
390
400
|
TARGET_LINK_LIBRARIES(git2 ${ICONV_LIBRARIES})
|
391
401
|
TARGET_OS_LIBRARIES(git2)
|
392
402
|
|
@@ -453,6 +463,7 @@ IF (BUILD_CLAR)
|
|
453
463
|
|
454
464
|
TARGET_LINK_LIBRARIES(libgit2_clar ${SSL_LIBRARIES})
|
455
465
|
TARGET_LINK_LIBRARIES(libgit2_clar ${SSH_LIBRARIES})
|
466
|
+
TARGET_LINK_LIBRARIES(libgit2_clar ${GSSAPI_LIBRARIES})
|
456
467
|
TARGET_LINK_LIBRARIES(libgit2_clar ${ICONV_LIBRARIES})
|
457
468
|
TARGET_OS_LIBRARIES(libgit2_clar)
|
458
469
|
MSVC_SPLIT_SOURCES(libgit2_clar)
|
@@ -0,0 +1,324 @@
|
|
1
|
+
# - Try to find GSSAPI
|
2
|
+
# Once done this will define
|
3
|
+
#
|
4
|
+
# KRB5_CONFIG - Path to krb5-config
|
5
|
+
# GSSAPI_ROOT_DIR - Set this variable to the root installation of GSSAPI
|
6
|
+
#
|
7
|
+
# Read-Only variables:
|
8
|
+
# GSSAPI_FLAVOR_MIT - set to TURE if MIT Kerberos has been found
|
9
|
+
# GSSAPI_FLAVOR_HEIMDAL - set to TRUE if Heimdal Keberos has been found
|
10
|
+
# GSSAPI_FOUND - system has GSSAPI
|
11
|
+
# GSSAPI_INCLUDE_DIR - the GSSAPI include directory
|
12
|
+
# GSSAPI_LIBRARIES - Link these to use GSSAPI
|
13
|
+
# GSSAPI_DEFINITIONS - Compiler switches required for using GSSAPI
|
14
|
+
#
|
15
|
+
#=============================================================================
|
16
|
+
# Copyright (c) 2013 Andreas Schneider <asn@cryptomilk.org>
|
17
|
+
#
|
18
|
+
# Distributed under the OSI-approved BSD License (the "License");
|
19
|
+
# see accompanying file Copyright.txt for details.
|
20
|
+
#
|
21
|
+
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
22
|
+
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
23
|
+
# See the License for more information.
|
24
|
+
#=============================================================================
|
25
|
+
#
|
26
|
+
|
27
|
+
find_path(GSSAPI_ROOT_DIR
|
28
|
+
NAMES
|
29
|
+
include/gssapi.h
|
30
|
+
include/gssapi/gssapi.h
|
31
|
+
HINTS
|
32
|
+
${_GSSAPI_ROOT_HINTS}
|
33
|
+
PATHS
|
34
|
+
${_GSSAPI_ROOT_PATHS}
|
35
|
+
)
|
36
|
+
mark_as_advanced(GSSAPI_ROOT_DIR)
|
37
|
+
|
38
|
+
if (UNIX)
|
39
|
+
find_program(KRB5_CONFIG
|
40
|
+
NAMES
|
41
|
+
krb5-config
|
42
|
+
PATHS
|
43
|
+
${GSSAPI_ROOT_DIR}/bin
|
44
|
+
/opt/local/bin)
|
45
|
+
mark_as_advanced(KRB5_CONFIG)
|
46
|
+
|
47
|
+
if (KRB5_CONFIG)
|
48
|
+
# Check if we have MIT KRB5
|
49
|
+
execute_process(
|
50
|
+
COMMAND
|
51
|
+
${KRB5_CONFIG} --vendor
|
52
|
+
RESULT_VARIABLE
|
53
|
+
_GSSAPI_VENDOR_RESULT
|
54
|
+
OUTPUT_VARIABLE
|
55
|
+
_GSSAPI_VENDOR_STRING)
|
56
|
+
|
57
|
+
if (_GSSAPI_VENDOR_STRING MATCHES ".*Massachusetts.*")
|
58
|
+
set(GSSAPI_FLAVOR_MIT TRUE)
|
59
|
+
else()
|
60
|
+
execute_process(
|
61
|
+
COMMAND
|
62
|
+
${KRB5_CONFIG} --libs gssapi
|
63
|
+
RESULT_VARIABLE
|
64
|
+
_GSSAPI_LIBS_RESULT
|
65
|
+
OUTPUT_VARIABLE
|
66
|
+
_GSSAPI_LIBS_STRING)
|
67
|
+
|
68
|
+
if (_GSSAPI_LIBS_STRING MATCHES ".*roken.*")
|
69
|
+
set(GSSAPI_FLAVOR_HEIMDAL TRUE)
|
70
|
+
endif()
|
71
|
+
endif()
|
72
|
+
|
73
|
+
# Get the include dir
|
74
|
+
execute_process(
|
75
|
+
COMMAND
|
76
|
+
${KRB5_CONFIG} --cflags gssapi
|
77
|
+
RESULT_VARIABLE
|
78
|
+
_GSSAPI_INCLUDE_RESULT
|
79
|
+
OUTPUT_VARIABLE
|
80
|
+
_GSSAPI_INCLUDE_STRING)
|
81
|
+
string(REGEX REPLACE "(\r?\n)+$" "" _GSSAPI_INCLUDE_STRING "${_GSSAPI_INCLUDE_STRING}")
|
82
|
+
string(REGEX REPLACE " *-I" "" _GSSAPI_INCLUDEDIR "${_GSSAPI_INCLUDE_STRING}")
|
83
|
+
endif()
|
84
|
+
|
85
|
+
if (NOT GSSAPI_FLAVOR_MIT AND NOT GSSAPI_FLAVOR_HEIMDAL)
|
86
|
+
# Check for HEIMDAL
|
87
|
+
find_package(PkgConfig)
|
88
|
+
if (PKG_CONFIG_FOUND)
|
89
|
+
pkg_check_modules(_GSSAPI heimdal-gssapi)
|
90
|
+
endif (PKG_CONFIG_FOUND)
|
91
|
+
|
92
|
+
if (_GSSAPI_FOUND)
|
93
|
+
set(GSSAPI_FLAVOR_HEIMDAL TRUE)
|
94
|
+
else()
|
95
|
+
find_path(_GSSAPI_ROKEN
|
96
|
+
NAMES
|
97
|
+
roken.h
|
98
|
+
PATHS
|
99
|
+
${GSSAPI_ROOT_DIR}/include
|
100
|
+
${_GSSAPI_INCLUDEDIR})
|
101
|
+
if (_GSSAPI_ROKEN)
|
102
|
+
set(GSSAPI_FLAVOR_HEIMDAL TRUE)
|
103
|
+
endif()
|
104
|
+
endif ()
|
105
|
+
endif()
|
106
|
+
endif (UNIX)
|
107
|
+
|
108
|
+
find_path(GSSAPI_INCLUDE_DIR
|
109
|
+
NAMES
|
110
|
+
gssapi.h
|
111
|
+
gssapi/gssapi.h
|
112
|
+
PATHS
|
113
|
+
${GSSAPI_ROOT_DIR}/include
|
114
|
+
${_GSSAPI_INCLUDEDIR}
|
115
|
+
)
|
116
|
+
|
117
|
+
if (GSSAPI_FLAVOR_MIT)
|
118
|
+
find_library(GSSAPI_LIBRARY
|
119
|
+
NAMES
|
120
|
+
gssapi_krb5
|
121
|
+
PATHS
|
122
|
+
${GSSAPI_ROOT_DIR}/lib
|
123
|
+
${_GSSAPI_LIBDIR}
|
124
|
+
)
|
125
|
+
|
126
|
+
find_library(KRB5_LIBRARY
|
127
|
+
NAMES
|
128
|
+
krb5
|
129
|
+
PATHS
|
130
|
+
${GSSAPI_ROOT_DIR}/lib
|
131
|
+
${_GSSAPI_LIBDIR}
|
132
|
+
)
|
133
|
+
|
134
|
+
find_library(K5CRYPTO_LIBRARY
|
135
|
+
NAMES
|
136
|
+
k5crypto
|
137
|
+
PATHS
|
138
|
+
${GSSAPI_ROOT_DIR}/lib
|
139
|
+
${_GSSAPI_LIBDIR}
|
140
|
+
)
|
141
|
+
|
142
|
+
find_library(COM_ERR_LIBRARY
|
143
|
+
NAMES
|
144
|
+
com_err
|
145
|
+
PATHS
|
146
|
+
${GSSAPI_ROOT_DIR}/lib
|
147
|
+
${_GSSAPI_LIBDIR}
|
148
|
+
)
|
149
|
+
|
150
|
+
if (GSSAPI_LIBRARY)
|
151
|
+
set(GSSAPI_LIBRARIES
|
152
|
+
${GSSAPI_LIBRARIES}
|
153
|
+
${GSSAPI_LIBRARY}
|
154
|
+
)
|
155
|
+
endif (GSSAPI_LIBRARY)
|
156
|
+
|
157
|
+
if (KRB5_LIBRARY)
|
158
|
+
set(GSSAPI_LIBRARIES
|
159
|
+
${GSSAPI_LIBRARIES}
|
160
|
+
${KRB5_LIBRARY}
|
161
|
+
)
|
162
|
+
endif (KRB5_LIBRARY)
|
163
|
+
|
164
|
+
if (K5CRYPTO_LIBRARY)
|
165
|
+
set(GSSAPI_LIBRARIES
|
166
|
+
${GSSAPI_LIBRARIES}
|
167
|
+
${K5CRYPTO_LIBRARY}
|
168
|
+
)
|
169
|
+
endif (K5CRYPTO_LIBRARY)
|
170
|
+
|
171
|
+
if (COM_ERR_LIBRARY)
|
172
|
+
set(GSSAPI_LIBRARIES
|
173
|
+
${GSSAPI_LIBRARIES}
|
174
|
+
${COM_ERR_LIBRARY}
|
175
|
+
)
|
176
|
+
endif (COM_ERR_LIBRARY)
|
177
|
+
endif (GSSAPI_FLAVOR_MIT)
|
178
|
+
|
179
|
+
if (GSSAPI_FLAVOR_HEIMDAL)
|
180
|
+
find_library(GSSAPI_LIBRARY
|
181
|
+
NAMES
|
182
|
+
gssapi
|
183
|
+
PATHS
|
184
|
+
${GSSAPI_ROOT_DIR}/lib
|
185
|
+
${_GSSAPI_LIBDIR}
|
186
|
+
)
|
187
|
+
|
188
|
+
find_library(KRB5_LIBRARY
|
189
|
+
NAMES
|
190
|
+
krb5
|
191
|
+
PATHS
|
192
|
+
${GSSAPI_ROOT_DIR}/lib
|
193
|
+
${_GSSAPI_LIBDIR}
|
194
|
+
)
|
195
|
+
|
196
|
+
find_library(HCRYPTO_LIBRARY
|
197
|
+
NAMES
|
198
|
+
hcrypto
|
199
|
+
PATHS
|
200
|
+
${GSSAPI_ROOT_DIR}/lib
|
201
|
+
${_GSSAPI_LIBDIR}
|
202
|
+
)
|
203
|
+
|
204
|
+
find_library(COM_ERR_LIBRARY
|
205
|
+
NAMES
|
206
|
+
com_err
|
207
|
+
PATHS
|
208
|
+
${GSSAPI_ROOT_DIR}/lib
|
209
|
+
${_GSSAPI_LIBDIR}
|
210
|
+
)
|
211
|
+
|
212
|
+
find_library(HEIMNTLM_LIBRARY
|
213
|
+
NAMES
|
214
|
+
heimntlm
|
215
|
+
PATHS
|
216
|
+
${GSSAPI_ROOT_DIR}/lib
|
217
|
+
${_GSSAPI_LIBDIR}
|
218
|
+
)
|
219
|
+
|
220
|
+
find_library(HX509_LIBRARY
|
221
|
+
NAMES
|
222
|
+
hx509
|
223
|
+
PATHS
|
224
|
+
${GSSAPI_ROOT_DIR}/lib
|
225
|
+
${_GSSAPI_LIBDIR}
|
226
|
+
)
|
227
|
+
|
228
|
+
find_library(ASN1_LIBRARY
|
229
|
+
NAMES
|
230
|
+
asn1
|
231
|
+
PATHS
|
232
|
+
${GSSAPI_ROOT_DIR}/lib
|
233
|
+
${_GSSAPI_LIBDIR}
|
234
|
+
)
|
235
|
+
|
236
|
+
find_library(WIND_LIBRARY
|
237
|
+
NAMES
|
238
|
+
wind
|
239
|
+
PATHS
|
240
|
+
${GSSAPI_ROOT_DIR}/lib
|
241
|
+
${_GSSAPI_LIBDIR}
|
242
|
+
)
|
243
|
+
|
244
|
+
find_library(ROKEN_LIBRARY
|
245
|
+
NAMES
|
246
|
+
roken
|
247
|
+
PATHS
|
248
|
+
${GSSAPI_ROOT_DIR}/lib
|
249
|
+
${_GSSAPI_LIBDIR}
|
250
|
+
)
|
251
|
+
|
252
|
+
if (GSSAPI_LIBRARY)
|
253
|
+
set(GSSAPI_LIBRARIES
|
254
|
+
${GSSAPI_LIBRARIES}
|
255
|
+
${GSSAPI_LIBRARY}
|
256
|
+
)
|
257
|
+
endif (GSSAPI_LIBRARY)
|
258
|
+
|
259
|
+
if (KRB5_LIBRARY)
|
260
|
+
set(GSSAPI_LIBRARIES
|
261
|
+
${GSSAPI_LIBRARIES}
|
262
|
+
${KRB5_LIBRARY}
|
263
|
+
)
|
264
|
+
endif (KRB5_LIBRARY)
|
265
|
+
|
266
|
+
if (HCRYPTO_LIBRARY)
|
267
|
+
set(GSSAPI_LIBRARIES
|
268
|
+
${GSSAPI_LIBRARIES}
|
269
|
+
${HCRYPTO_LIBRARY}
|
270
|
+
)
|
271
|
+
endif (HCRYPTO_LIBRARY)
|
272
|
+
|
273
|
+
if (COM_ERR_LIBRARY)
|
274
|
+
set(GSSAPI_LIBRARIES
|
275
|
+
${GSSAPI_LIBRARIES}
|
276
|
+
${COM_ERR_LIBRARY}
|
277
|
+
)
|
278
|
+
endif (COM_ERR_LIBRARY)
|
279
|
+
|
280
|
+
if (HEIMNTLM_LIBRARY)
|
281
|
+
set(GSSAPI_LIBRARIES
|
282
|
+
${GSSAPI_LIBRARIES}
|
283
|
+
${HEIMNTLM_LIBRARY}
|
284
|
+
)
|
285
|
+
endif (HEIMNTLM_LIBRARY)
|
286
|
+
|
287
|
+
if (HX509_LIBRARY)
|
288
|
+
set(GSSAPI_LIBRARIES
|
289
|
+
${GSSAPI_LIBRARIES}
|
290
|
+
${HX509_LIBRARY}
|
291
|
+
)
|
292
|
+
endif (HX509_LIBRARY)
|
293
|
+
|
294
|
+
if (ASN1_LIBRARY)
|
295
|
+
set(GSSAPI_LIBRARIES
|
296
|
+
${GSSAPI_LIBRARIES}
|
297
|
+
${ASN1_LIBRARY}
|
298
|
+
)
|
299
|
+
endif (ASN1_LIBRARY)
|
300
|
+
|
301
|
+
if (WIND_LIBRARY)
|
302
|
+
set(GSSAPI_LIBRARIES
|
303
|
+
${GSSAPI_LIBRARIES}
|
304
|
+
${WIND_LIBRARY}
|
305
|
+
)
|
306
|
+
endif (WIND_LIBRARY)
|
307
|
+
|
308
|
+
if (ROKEN_LIBRARY)
|
309
|
+
set(GSSAPI_LIBRARIES
|
310
|
+
${GSSAPI_LIBRARIES}
|
311
|
+
${WIND_LIBRARY}
|
312
|
+
)
|
313
|
+
endif (ROKEN_LIBRARY)
|
314
|
+
endif (GSSAPI_FLAVOR_HEIMDAL)
|
315
|
+
|
316
|
+
include(FindPackageHandleStandardArgs)
|
317
|
+
find_package_handle_standard_args(GSSAPI DEFAULT_MSG GSSAPI_LIBRARIES GSSAPI_INCLUDE_DIR)
|
318
|
+
|
319
|
+
if (GSSAPI_INCLUDE_DIRS AND GSSAPI_LIBRARIES)
|
320
|
+
set(GSSAPI_FOUND TRUE)
|
321
|
+
endif (GSSAPI_INCLUDE_DIRS AND GSSAPI_LIBRARIES)
|
322
|
+
|
323
|
+
# show the GSSAPI_INCLUDE_DIRS and GSSAPI_LIBRARIES variables only in the advanced view
|
324
|
+
mark_as_advanced(GSSAPI_INCLUDE_DIRS GSSAPI_LIBRARIES)
|