Ticket #35852: patch-macports-customizations.diff
File patch-macports-customizations.diff, 26.5 KB (added by cawka (Alex Afanasyev), 12 years ago) |
---|
-
Makefile
diff --git Makefile Makefile index 2748ac8..cf3292a 100644
13 13 # 14 14 15 15 # Subdirectories we build in 16 TOPSUBDIRS = doc/manpages doc/technical csrc schema javasrc apps`cat local.subdirs 2>/dev/null || :`16 TOPSUBDIRS = doc/manpages doc/technical csrc schema `cat local.subdirs 2>/dev/null || :` 17 17 # Packing list for packaging 18 18 PACKLIST = Makefile README LICENSE NEWS NOTICES configure doc/index.txt $(TOPSUBDIRS) android experiments 19 19 BLDMSG = printf '=== %s ' 'Building $@ in' && pwd 20 20 21 # Include build parameters 22 include csrc/conf.mk 23 21 24 default all: _always 22 25 for i in $(TOPSUBDIRS); do \ 23 26 (cd "$$i" && pwd && $(MAKE) $@) || exit 1; \ 24 27 done 25 (cd csrc/lib && { test -f "$$HOME/.ccnx/.ccnx_keystore" || $(MAKE) test; }; ) 28 if [ "x$(BUILD_JAVA)" = "xtrue" ]; then \ 29 (cd javasrc && $(MAKE) $@); \ 30 if [ "x$(BUILD_APPS)" = "xtrue" ]; then \ 31 (cd apps && $(MAKE) $@); \ 32 fi; \ 33 fi 26 34 mkdir -p ./lib ./bin 27 35 test -d ./include || ln -s ./csrc/include 28 36 (cd csrc && $(MAKE) install INSTALL_BASE=`pwd`/..) 29 (cd javasrc && $(MAKE) install INSTALL_BASE=`pwd`/..) 30 (cd apps && $(MAKE) install INSTALL_BASE=`pwd`/..) 37 if [ "x$(BUILD_JAVA)" = "xtrue" ]; then \ 38 (cd javasrc && $(MAKE) install INSTALL_BASE=`pwd`/..); \ 39 if [ "x$(BUILD_APPS)" = "xtrue" ]; then \ 40 (cd apps && $(MAKE) install INSTALL_BASE=`pwd`/..); \ 41 fi ;\ 42 fi 31 43 32 44 clean depend test check shared: _always 33 for i in $(TOPSUBDIRS) ; do \45 for i in $(TOPSUBDIRS) javasrc apps; do \ 34 46 (cd "$$i" && pwd && $(MAKE) $@) || exit 1; \ 35 47 done 36 48 @rm -f _always 37 49 38 50 testinstall install uninstall: _always 39 IB=`[ -z '$(INSTALL_BASE)' ] && grep ^INSTALL_BASE csrc/conf.mk 2>/dev/null | sed -e 's/ //g' || echo INSTALL_BASE=$(INSTALL_BASE)`; \ 40 for i in $(TOPSUBDIRS); do \ 41 (cd "$$i" && pwd && $(MAKE) $$IB $@) || exit 1; \ 51 for i in $(TOPSUBDIRS) javasrc apps; do \ 52 (cd "$$i" && pwd && $(MAKE) $@) || exit 1; \ 42 53 done 43 54 @rm -f _always 44 55 45 56 documentation dist-docs: _always 46 for i in $(TOPSUBDIRS) android; do \57 for i in $(TOPSUBDIRS) javasrc apps android; do \ 47 58 (cd "$$i" && pwd && $(MAKE) $@) || exit 1; \ 48 59 done 49 60 @rm -f _always -
apps/Makefile
diff --git apps/Makefile apps/Makefile index acc347c..f0d8638 100644
19 19 20 20 SUBDIRS = HttpProxy ccnChat ccnFileProxy `cat local.subdirs 2>/dev/null || :` 21 21 MAKEF = -f ../conf.mk -f dir.mk -f ../subr.mk $(PASSTHRU) 22 PASSTHRU = `[ -z '$(INSTALL_BASE)' ] || echo INSTALL_BASE=$( INSTALL_BASE)`22 PASSTHRU = `[ -z '$(INSTALL_BASE)' ] || echo INSTALL_BASE=$(DESTDIR)$(INSTALL_BASE)` 23 23 CFLAGS = -g 24 24 CSRCDIR = ../csrc 25 25 -
apps/java.mk
diff --git apps/java.mk apps/java.mk index df9358e..d1cf718 100644
12 12 # FOR A PARTICULAR PURPOSE. 13 13 # 14 14 15 include ../conf.mk 16 15 17 ANT = `command -v ant || echo echo SKIPPING ant` 16 18 LIBS = $(JAR) 17 19 WHINE = sh -c "type $(ANT) 2>/dev/null || \ 18 20 echo Skipping java build in $$(pwd -L) - \ 19 21 $(ANT) is not installed; " 20 # Default, the top-level Makefile default target will21 # call the install target here but override INSTALL_BASE22 # with dir in the source tree23 INSTALL_LIB = $(INSTALL_BASE)/lib24 INSTALL_BIN = $(INSTALL_BASE)/bin25 INSTALL = cp26 CP = cp27 LS = /bin/ls28 22 29 23 default all: jar 30 24 check: test 31 25 32 26 install: 33 27 @test -f $(JAR) && $(MAKE) real_install \ 34 INSTALL_BASE=$( INSTALL_BASE) \35 INSTALL_LIB=$( INSTALL_LIB) \36 INSTALL_BIN=$( INSTALL_BIN) || $(WARN_NO_INSTALL)28 INSTALL_BASE=$(DESTDIR)$(INSTALL_BASE) \ 29 INSTALL_LIB=$(DESTDIR)$(INSTALL_LIB) \ 30 INSTALL_BIN=$(DESTDIR)$(INSTALL_BIN) || $(WARN_NO_INSTALL) 37 31 38 32 real_install: _always 39 33 test -d $(INSTALL_LIB) … … real_install: _always 43 37 $(CP) -R tools/. $(INSTALL_BIN) 44 38 45 39 uninstall: 46 for i in $(LIBS) ""; do test -z "$$i" || rm -f $( INSTALL_LIB)/`basename $$i`; done47 for i in `$(LS) tools` "" ; do test -z "$$i" || rm -f $( INSTALL_BIN)/`basename $$i`; done40 for i in $(LIBS) ""; do test -z "$$i" || rm -f $(DESTDIR)$(INSTALL_LIB)/`basename $$i`; done 41 for i in `$(LS) tools` "" ; do test -z "$$i" || rm -f $(DESTDIR)$(INSTALL_BIN)/`basename $$i`; done 48 42 49 43 # Use ant to actually do the work for these targets 50 44 jar test: _always -
deleted file csrc/ccnd/ccnd-init-keystore-helper.sh
diff --git csrc/ccnd/ccnd-init-keystore-helper.sh csrc/ccnd/ccnd-init-keystore-helper.sh deleted file mode 100755 index ede0153..0000000
+ - 1 #!/bin/sh2 # ccnd/ccnd-init-keystore-helper.sh3 #4 # Part of the CCNx distribution.5 #6 # Copyright (C) 2009 Palo Alto Research Center, Inc.7 #8 # This work is free software; you can redistribute it and/or modify it under9 # the terms of the GNU General Public License version 2 as published by the10 # Free Software Foundation.11 # This work is distributed in the hope that it will be useful, but WITHOUT ANY12 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS13 # FOR A PARTICULAR PURPOSE.14 #15 : ${RSA_KEYSIZE:=1024}16 exec >&217 Fail () {18 echo '*** Failed' "$*"19 exit 120 }21 cd `dirname "$1"` || Fail bad setup22 umask 07723 trap 'rm -f *.pem openssl.cnf p' 024 cat <<EOF >openssl.cnf25 # This is not really relevant because we're not sending cert requests anywhere,26 # but openssl req can refuse to go on if it has no config file.27 [ req ]28 distinguished_name = req_distinguished_name29 [ req_distinguished_name ]30 countryName = Country Name (2 letter code)31 countryName_default = AU32 countryName_min = 233 countryName_max = 234 EOF35 openssl req -config openssl.cnf \36 -newkey rsa:$RSA_KEYSIZE \37 -x509 \38 -keyout private_key.pem \39 -out certout.pem \40 -subj /CN="CCND-internal" \41 -nodes || Fail openssl req42 openssl pkcs12 -export \43 -name "CCND" \44 -out "$1" \45 -in certout.pem \46 -inkey private_key.pem \47 -password file:p || Fail openssl pkcs12 -
csrc/ccnd/dir.mk
diff --git csrc/ccnd/dir.mk csrc/ccnd/dir.mk index 72c8438..2ec0946 100644
15 15 LDLIBS = -L$(CCNLIBDIR) $(MORE_LDLIBS) -lccn 16 16 CCNLIBDIR = ../lib 17 17 18 INSTALLED_PROGRAMS = ccnd ccndsmoketest ccnd-init-keystore-helper18 INSTALLED_PROGRAMS = ccnd ccndsmoketest 19 19 PROGRAMS = $(INSTALLED_PROGRAMS) 20 20 DEBRIS = anything.ccnb contentobjecthash.ccnb contentmishash.ccnb \ 21 21 contenthash.ccnb … … BROKEN_PROGRAMS = 24 24 CSRC = ccnd_main.c ccnd.c ccnd_msg.c ccnd_stats.c ccnd_internal_client.c ccndsmoketest.c 25 25 HSRC = ccnd_private.h 26 26 SCRIPTSRC = testbasics fortunes.ccnb contentobjecthash.ref anything.ref \ 27 ccnd-init-keystore-helper.shminsuffix.ref27 minsuffix.ref 28 28 29 29 default: $(PROGRAMS) 30 30 … … ccnd: $(CCND_OBJ) ccnd_built.sh 40 40 ccnd_built.sh: 41 41 touch ccnd_built.sh 42 42 43 ccnd-init-keystore-helper: ccnd-init-keystore-helper.sh44 sed -e 's@/bin/sh@'`which sh`'@g' ccnd-init-keystore-helper.sh > $@45 chmod +x $@46 47 43 ccndsmoketest: ccndsmoketest.o 48 44 $(CC) $(CFLAGS) -o $@ ccndsmoketest.o $(LDLIBS) 49 45 -
csrc/configure
diff --git csrc/configure csrc/configure index 962d76a..e838792 100755
TryAppend "`uname -sr | sed -e 's/ /-/g'`" 39 39 TryAppend "local" 40 40 TryScript "`uname`" "$@" 41 41 TryScript "local" "$@" 42 ProvideDefault CPREFLAGS = -I../include 43 ProvideDefault PCAP_PROGRAMS = ccndumppcap 44 ProvideDefault RESOLV_LIBS = -lresolv 42 ProvideDefault CC = ${CC:=cc} 43 ProvideDefault CPREFLAGS = -I../include ${CFLAGS:-} 44 ProvideDefault PCAP_PROGRAMS = ${PCAP_PROGRAMS:-ccndumppcap} 45 ProvideDefault RESOLV_LIBS = ${RESOLV_LIBS:--lresolv} 45 46 ProvideDefault INSTALL_BASE = ${INSTALL_BASE:-/usr/local} 46 ProvideDefault INSTALL_INCLUDE = '$(INSTALL_BASE)/include' 47 ProvideDefault INSTALL_LIB = '$(INSTALL_BASE)/lib' 48 ProvideDefault INSTALL_BIN = '$(INSTALL_BASE)/bin' 49 ProvideDefault INSTALL = install 50 ProvideDefault RM = rm -f 51 ProvideDefault SH = /bin/sh 47 ProvideDefault INSTALL_INCLUDE = ${INSTALL_INCLUDE:-\$(INSTALL_BASE)/include} 48 ProvideDefault INSTALL_LIB = ${INSTALL_LIB:-\$(INSTALL_BASE)/lib} 49 ProvideDefault INSTALL_BIN = ${INSTALL_BIN:-\$(INSTALL_BASE)/bin} 50 ProvideDefault INSTALL = ${INSTALL:-install} 51 ProvideDefault CP = ${CP:-cp} 52 ProvideDefault RM = ${RM:-rm -f} 53 ProvideDefault SH = ${SH:-/bin/sh} 54 ProvideDefault LS = ${LS:-/bin/ls} 55 56 ProvideDefault BUILD_JAVA = ${BUILD_JAVA:-true} 57 ProvideDefault BUILD_APPS = ${BUILD_APPS:-true} 52 58 53 59 echo ============= conf.mk =============>&2 54 60 cat conf.mk >&2 -
csrc/include/ccn/ccn.h
diff --git csrc/include/ccn/ccn.h csrc/include/ccn/ccn.h index 548d5d4..22990fb 100644
int ccn_encode_StatusResponse(struct ccn_charbuf *buf, 911 911 * error encountered during a call using the given handle. 912 912 * ccn_seterror records error info, ccn_geterror gets it. 913 913 */ 914 void ccn_perror(struct ccn *h, const char *s );914 void ccn_perror(struct ccn *h, const char *s, ...); 915 915 int ccn_seterror(struct ccn *h, int error_code); 916 916 int ccn_geterror(struct ccn *h); 917 917 -
csrc/lib/ccn_client.c
diff --git csrc/lib/ccn_client.c csrc/lib/ccn_client.c index 606fd36..35f2b43 100644
tv_earlier(const struct timeval *a, const struct timeval *b) 163 163 * where available. 164 164 */ 165 165 void 166 ccn_perror(struct ccn *h, const char *s )166 ccn_perror(struct ccn *h, const char *s, ...) 167 167 { 168 168 const char *dlm = ": "; 169 va_list ap; 170 va_start(ap, s); 171 169 172 if (s == NULL) { 170 173 if (h->err > 0) 171 174 s = strerror(h->err); … … ccn_perror(struct ccn *h, const char *s) 173 176 dlm = s = ""; 174 177 } 175 178 // XXX - time stamp 176 fprintf(stderr, "ccn_client.c:%d[%d] - error %d%s%s\n", 177 h->errline, (int)getpid(), h->err, dlm, s); 179 fprintf(stderr, "ccn_client.c:%d[%d] - error %d%s", 180 h->errline, (int)getpid(), h->err, dlm); 181 vfprintf(stderr, s, ap); 182 fprintf(stderr, "\n"); 178 183 } 179 184 180 185 static int … … ccn_get_public_key(struct ccn *h, 2562 2567 return(res); 2563 2568 } 2564 2569 2570 int 2571 ccn_load_key_or_create(struct ccn *h, 2572 const char *keystore, 2573 struct ccn_charbuf *default_pubid, 2574 size_t key_size) 2575 { 2576 const char *password = NULL; 2577 int res = 0; 2578 2579 password = getenv ("CCNX_KEYSTORE_PASSWORD"); 2580 if (password == 0) { 2581 password = "Th1s1sn0t8g00dp8ssw0rd."; 2582 } 2583 2584 res = ccn_load_private_key(h, 2585 keystore, 2586 password, 2587 default_pubid); 2588 2589 if (res != 0 || default_pubid->length != key_size) { 2590 // two cases, either file exists and we password is wrong or file does not exist 2591 2592 if (access (keystore, R_OK) == 0) { 2593 ccn_perror (h, "Keystore file [%s] exists, but private key cannot be loaded. " 2594 "Check if CCNX_KEYSTORE_PASSWORD is set to a correct password, " 2595 "otherwise remove [%s] and it will be automatically created.", 2596 keystore, keystore); 2597 res = NOTE_ERR (h, -1); 2598 return res; 2599 } 2600 2601 ccn_perror (h, "Keystore [%s] does not exist and will be automatically created", keystore); 2602 2603 res = ccn_keystore_file_init ((char*)keystore, (char*)password, 2604 "ccnxuser", 0, 3650); // create a key valid for 10 years 2605 if (res != 0) { 2606 ccn_perror (h, "Cannot create keystore [%s]", keystore); 2607 res = NOTE_ERRNO (h); 2608 return res; 2609 } 2610 2611 res = ccn_load_private_key(h, 2612 keystore, 2613 password, 2614 default_pubid); 2615 if (res != 0 || default_pubid->length != key_size) { 2616 // this definitely should not happen 2617 ccn_perror (h, "Cannot load keystore [%s] just after it has been created", keystore); 2618 res = NOTE_ERRNO (h); 2619 return res; 2620 } 2621 } 2622 2623 return res; 2624 } 2625 2565 2626 /** 2566 2627 * This is mostly for use within the library, 2567 2628 * but may be useful for some clients. … … ccn_chk_signing_params(struct ccn *h, 2582 2643 int i; 2583 2644 int conflicting; 2584 2645 int needed; 2646 struct stat sb; 2585 2647 2586 2648 if (params != NULL) 2587 2649 *result = *params; … … ccn_chk_signing_params(struct ccn *h, 2607 2669 temp = ccn_charbuf_create(); 2608 2670 if (default_pubid == NULL || temp == NULL) 2609 2671 return(NOTE_ERRNO(h)); 2672 2673 res = -1; 2674 2675 // check CCNX_DIR 2610 2676 ccnx_dir = getenv("CCNX_DIR"); 2611 if (ccnx_dir == NULL || ccnx_dir[0] == 0) { 2612 home = getenv("HOME"); 2613 if (home == NULL) 2614 home = ""; 2677 if (ccnx_dir != NULL && ccnx_dir[0] != 0) { 2678 ccn_charbuf_reset(temp); 2679 ccn_charbuf_putf(temp, "%s/.ccnx_keystore", ccnx_dir); 2680 2681 res = ccn_load_key_or_create (h, 2682 ccn_charbuf_as_string (temp), 2683 default_pubid, 2684 sizeof(result->pubid)); 2685 } 2686 2687 if (res < 0) { 2688 // check HOME 2689 home = getenv("HOME"); 2690 if (home != NULL) { 2691 // step 1. Check if home directory exists 2692 ccn_charbuf_reset(temp); 2693 ccn_charbuf_putf(temp, "%s/.ccnx", home); 2694 2695 res = stat (ccn_charbuf_as_string (temp), &sb); 2696 if (res != 0 || !(sb.st_mode & S_IFDIR)) 2697 { 2698 res = mkdir (ccn_charbuf_as_string (temp), S_IRWXU); 2699 if (res != 0) 2700 { 2701 ccn_perror (h, "Failed to create directory [%s]", ccn_charbuf_as_string (temp)); 2702 } 2703 } 2704 2705 ccn_charbuf_reset(temp); 2615 2706 ccn_charbuf_putf(temp, "%s/.ccnx/.ccnx_keystore", home); 2707 2708 res = ccn_load_key_or_create (h, 2709 ccn_charbuf_as_string (temp), 2710 default_pubid, 2711 sizeof(result->pubid)); 2712 } 2616 2713 } 2617 else 2618 ccn_charbuf_putf(temp, "%s/.ccnx_keystore", ccnx_dir); 2619 res = ccn_load_private_key(h, 2620 ccn_charbuf_as_string(temp), 2621 "Th1s1sn0t8g00dp8ssw0rd.", 2622 default_pubid); 2623 if (res == 0 && default_pubid->length == sizeof(result->pubid)) { 2714 2715 if (res == 0) { 2624 2716 h->default_pubid = default_pubid; 2625 2717 default_pubid = NULL; 2626 2718 } 2719 else { 2720 ccn_perror(h, "Fail to load private key from keystore"); 2721 res = NOTE_ERRNO (h); 2722 } 2627 2723 } 2628 2724 if (h->default_pubid == NULL) 2629 2725 res = NOTE_ERRNO(h); -
deleted file csrc/lib/ccn_initkeystore.sh
diff --git csrc/lib/ccn_initkeystore.sh csrc/lib/ccn_initkeystore.sh deleted file mode 100755 index 12bc9e3..0000000
+ - 1 #!/bin/sh2 # lib/ccn_initkeystore.sh3 #4 # Part of the CCNx distribution.5 #6 # Copyright (C) 2009-2010 Palo Alto Research Center, Inc.7 #8 # This work is free software; you can redistribute it and/or modify it under9 # the terms of the GNU General Public License version 2 as published by the10 # Free Software Foundation.11 # This work is distributed in the hope that it will be useful, but WITHOUT ANY12 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS13 # FOR A PARTICULAR PURPOSE.14 #15 # Create a ccn keystore without relying on java16 : ${RSA_KEYSIZE:=1024}17 : ${CCN_USER:=`id -n -u`}18 Fail () {19 echo '*** Failed' "$*"20 exit 121 }22 test -d .ccnx && rm -rf .ccnx23 test $RSA_KEYSIZE -ge 512 || Fail \$RSA_KEYSIZE too small to sign CCN content24 (umask 077 && mkdir .ccnx) || Fail $0 Unable to create .ccnx directory25 cd .ccnx26 umask 07727 # Set a trap to cleanup on the way out28 trap 'rm -f *.pem openssl.cnf' 029 cat <<EOF >openssl.cnf30 # This is not really relevant because we're not sending cert requests anywhere,31 # but openssl req can refuse to go on if it has no config file.32 [ req ]33 distinguished_name = req_distinguished_name34 [ req_distinguished_name ]35 countryName = Country Name (2 letter code)36 countryName_default = AU37 countryName_min = 238 countryName_max = 239 EOF40 openssl req -config openssl.cnf \41 -newkey rsa:$RSA_KEYSIZE \42 -x509 \43 -keyout private_key.pem \44 -out certout.pem \45 -subj /CN="$CCN_USER" \46 -nodes || Fail openssl req47 openssl pkcs12 -export -name "ccnxuser" \48 -out .ccnx_keystore \49 -in certout.pem \50 -inkey private_key.pem \51 -password pass:'Th1s1sn0t8g00dp8ssw0rd.' || Fail openssl pkcs12 -
csrc/lib/dir.mk
diff --git csrc/lib/dir.mk csrc/lib/dir.mk index 6489299..c03316d 100644
PROGRAMS = hashtbtest skel_decode_test \ 21 21 22 22 BROKEN_PROGRAMS = 23 23 DEBRIS = ccn_verifysig _bt_* 24 SCRIPTSRC = ccn_initkeystore.sh25 24 CSRC = ccn_bloom.c \ 26 25 ccn_btree.c ccn_btree_content.c ccn_btree_store.c \ 27 26 ccn_buf_decoder.c ccn_buf_encoder.c ccn_bulkdata.c \ … … default all: dtag_check lib $(PROGRAMS) 56 55 # Don't try to build shared libs right now. 57 56 # all: shlib 58 57 59 all: basicparsetest ccn_verifysig58 # all: basicparsetest ccn_verifysig 60 59 61 60 install: install_headers 62 61 install_headers: 63 @test -d $( INSTALL_INCLUDE) || (echo $(INSTALL_INCLUDE) does not exist. Please mkdir -p$(INSTALL_INCLUDE) if this is what you intended. && exit 2)64 mkdir -p $( INSTALL_INCLUDE)/ccn62 @test -d $(DESTDIR)$(INSTALL_INCLUDE) || (echo $(DESTDIR)$(INSTALL_INCLUDE) does not exist. Please mkdir -p $(DESTDIR)$(INSTALL_INCLUDE) if this is what you intended. && exit 2) 63 mkdir -p $(DESTDIR)$(INSTALL_INCLUDE)/ccn 65 64 for i in `cd ../include/ccn && echo *.h`; do \ 66 cmp -s ../include/ccn/$$i $( INSTALL_INCLUDE)/ccn/$$i || \67 cp ../include/ccn/$$i $( INSTALL_INCLUDE)/ccn/$$i || \65 cmp -s ../include/ccn/$$i $(DESTDIR)$(INSTALL_INCLUDE)/ccn/$$i || \ 66 cp ../include/ccn/$$i $(DESTDIR)$(INSTALL_INCLUDE)/ccn/$$i || \ 68 67 exit 1; \ 69 68 done 70 69 71 70 uninstall: uninstall_headers 72 71 uninstall_headers: 73 test -L $( INSTALL_INCLUDE)/ccn && $(RM)$(INSTALL_INCLUDE)/ccn ||:74 test -L $( INSTALL_INCLUDE) || $(RM) -r$(INSTALL_INCLUDE)/ccn72 test -L $(DESTDIR)$(INSTALL_INCLUDE)/ccn && $(RM) $(DESTDIR)$(INSTALL_INCLUDE)/ccn ||: 73 test -L $(DESTDIR)$(INSTALL_INCLUDE) || $(RM) -r $(DESTDIR)$(INSTALL_INCLUDE)/ccn 75 74 76 75 shlib: $(SHLIBNAME) 77 76 78 77 lib: libccn.a 79 78 80 test: default keystore_checkencodedecodetest ccnbtreetest79 test: default encodedecodetest ccnbtreetest 81 80 ./encodedecodetest -o /dev/null 82 81 ./ccnbtreetest 83 82 ./ccnbtreetest - < q.dat … … test: default keystore_check encodedecodetest ccnbtreetest 86 85 dtag_check: _always 87 86 @./gen_dtag_table 2>/dev/null | diff - ccn_dtag_table.c | grep '^[<]' >/dev/null && echo '*** Warning: ccn_dtag_table.c may be out of sync with tagnames.cvsdict' || : 88 87 89 keystore_check: ccn_initkeystore.sh90 test -f "$$HOME/.ccnx/.ccnx_keystore" || $(MAKE) -f dir.mk new_keystore91 92 new_keystore:93 @echo === CCNx Keystore not found in your home directory94 @echo === I will create one for you now '(^C to abort)'95 sleep 1 && sh ccn_initkeystore.sh && sleep 3 && mv .ccnx "$$HOME"96 97 88 libccn.a: $(LIB_OBJS) 98 89 ar crus $@ $(LIB_OBJS) 99 90 … … skel_decode_test: skel_decode_test.o 113 104 basicparsetest: basicparsetest.o libccn.a 114 105 $(CC) $(CFLAGS) -o $@ basicparsetest.o $(LDLIBS) $(OPENSSL_LIBS) -lcrypto 115 106 116 encodedecodetest: encodedecodetest.o 107 encodedecodetest: encodedecodetest.o libccn.a 117 108 $(CC) $(CFLAGS) -o $@ encodedecodetest.o $(LDLIBS) $(OPENSSL_LIBS) -lcrypto 118 109 119 110 ccn_digest.o: … … ccn_fetch.o: 149 140 ccn_verifysig.o: 150 141 $(CC) $(CFLAGS) $(OPENSSL_CFLAGS) -c ccn_verifysig.c 151 142 152 ccn_verifysig: ccn_verifysig.o 143 ccn_verifysig: ccn_verifysig.o libccn.a 153 144 $(CC) $(CFLAGS) -o $@ ccn_verifysig.o $(LDLIBS) $(OPENSSL_LIBS) -lcrypto 154 145 155 146 signbenchtest.o: 156 147 $(CC) $(CFLAGS) $(OPENSSL_CFLAGS) -c signbenchtest.c 157 148 158 signbenchtest: signbenchtest.o 149 signbenchtest: signbenchtest.o libccn.a 159 150 $(CC) $(CFLAGS) -o $@ signbenchtest.o $(LDLIBS) $(OPENSSL_LIBS) -lcrypto 160 151 161 ccndumppcap: ccndumppcap.o 152 ccndumppcap: ccndumppcap.o libccn.a 162 153 $(CC) $(CFLAGS) -o $@ ccndumppcap.o $(LDLIBS) $(OPENSSL_LIBS) -lcrypto -lpcap 163 154 164 155 ccnbtreetest.o: -
csrc/lib/encodedecodetest.c
diff --git csrc/lib/encodedecodetest.c csrc/lib/encodedecodetest.c index be6a853..09e02ea 100644
main (int argc, char *argv[]) { 210 210 NULL}; 211 211 struct path * cur_path = NULL; 212 212 struct ccn_keystore *keystore = ccn_keystore_create(); 213 char *home = getenv("HOME");214 char *keystore_suffix = "/.ccnx/.ccnx_keystore";215 213 char *keystore_name = NULL; 214 char *keystore_password = NULL; 216 215 217 216 int i; 218 217 219 while ((i = getopt(argc, argv, "k: o:")) != -1) {218 while ((i = getopt(argc, argv, "k:p:o:")) != -1) { 220 219 switch (i) { 221 220 case 'k': 222 221 keystore_name = optarg; 223 222 break; 223 case 'p': 224 keystore_password = optarg; 225 break; 224 226 case 'o': 225 227 outname = optarg; 226 228 break; … … main (int argc, char *argv[]) { 231 233 } 232 234 233 235 234 if (keystore_name == NULL && home == NULL) {235 printf("Unable to determine home directory for keystore\n");236 exit(1);237 }238 236 if (keystore_name == NULL) { 239 keystore_name = calloc(1, strlen(home) + strlen(keystore_suffix) + 1); 240 strcat(keystore_name, home); 241 strcat(keystore_name, keystore_suffix); 237 keystore_name = tmpnam (NULL); // should be ok, there is just single thread 242 238 } 243 239 244 if (0 != ccn_keystore_init(keystore, keystore_name, "Th1s1sn0t8g00dp8ssw0rd.")) { 245 printf("Failed to initialize keystore\n"); 246 exit(1); 240 if (keystore_password == NULL) { 241 keystore_password = "Th1s1sn0t8g00dp8ssw0rd."; 247 242 } 248 243 244 res = ccn_keystore_init (keystore, keystore_name, keystore_password); 245 if (res != 0) 246 { 247 printf ("Initializing keystore in %s\n", keystore_name); 248 249 res = ccn_keystore_file_init (keystore_name, keystore_password, 250 "ccnxuser", 0, 3650); // create a key valid for 10 years 251 if (res != 0) { 252 fprintf (stderr, "Cannot create keystore [%s]", keystore_name); 253 return res; 254 } 255 256 // init again 257 res = ccn_keystore_init(keystore, keystore_name, keystore_password); 258 if (res != 0) { 259 printf("Failed to initialize keystore\n"); 260 exit(1); 261 } 262 } 263 264 265 266 267 249 268 printf("Creating signed_info\n"); 250 269 res = ccn_signed_info_create(signed_info, 251 270 /*pubkeyid*/ccn_keystore_public_key_digest(keystore), -
csrc/subr.mk
diff --git csrc/subr.mk csrc/subr.mk index e24c230..3361a49 100644
$(OBJDIR)/dir.mk: dir.mk 31 31 cp -p dir.mk $(OBJDIR)/dir.mk 32 32 33 33 install_libs: $(LIBS) 34 @test -d $( INSTALL_LIB) || (echo $(INSTALL_LIB) does not exist. Please mkdir -p$(INSTALL_LIB) if this is what you intended. && exit 2)35 for i in $(LIBS) ""; do test -z "$$i" || $(INSTALL) $$i $( INSTALL_LIB); done34 @test -d $(DESTDIR)$(INSTALL_LIB) || (echo $(DESTDIR)$(INSTALL_LIB) does not exist. Please mkdir -p $(DESTDIR)$(INSTALL_LIB) if this is what you intended. && exit 2) 35 for i in $(LIBS) ""; do test -z "$$i" || $(INSTALL) $$i $(DESTDIR)$(INSTALL_LIB); done 36 36 37 37 install_programs: $(INSTALLED_PROGRAMS) 38 @test -d $( INSTALL_BIN) || (echo $(INSTALL_BIN) does not exist. Please mkdir -p$(INSTALL_BIN) if this is what you intended. && exit 2)39 for i in $(INSTALLED_PROGRAMS) ""; do test -z "$$i" || $(INSTALL) $$i $( INSTALL_BIN); done38 @test -d $(DESTDIR)$(INSTALL_BIN) || (echo $(DESTDIR)$(INSTALL_BIN) does not exist. Please mkdir -p $(DESTDIR)$(INSTALL_BIN) if this is what you intended. && exit 2) 39 for i in $(INSTALLED_PROGRAMS) ""; do test -z "$$i" || $(INSTALL) $$i $(DESTDIR)$(INSTALL_BIN); done 40 40 41 41 install: install_libs install_programs 42 42 43 43 uninstall_libs: 44 for i in $(LIBS) ""; do test -z "$$i" || $(RM) $( INSTALL_LIB)/$$i; done44 for i in $(LIBS) ""; do test -z "$$i" || $(RM) $(DESTDIR)$(INSTALL_LIB)/$$i; done 45 45 46 46 uninstall_programs: 47 for i in $(PROGRAMS) ""; do test -z "$$i" || $(RM) $( INSTALL_BIN)/$$i; done47 for i in $(PROGRAMS) ""; do test -z "$$i" || $(RM) $(DESTDIR)$(INSTALL_BIN)/$$i; done 48 48 49 49 uninstall: uninstall_libs uninstall_programs 50 50 -
javasrc/Makefile
diff --git javasrc/Makefile javasrc/Makefile index c5b8444..d2237b6 100644
12 12 # FOR A PARTICULAR PURPOSE. 13 13 # 14 14 15 include ../csrc/conf.mk 16 15 17 ANT = `command -v ant || echo echo SKIPPING ant` 16 18 JAR = ccn.jar 17 19 LIBS = $(JAR) lib/bcprov-jdk16-143.jar lib/kxml2-2.3.0.jar $(EXTRA_LIBS) … … WARN_NO_INSTALL = echo Nothing installed from javasrc/ 23 25 # Default, the top-level Makefile default target will 24 26 # call the install target here but override INSTALL_BASE 25 27 # with dir in the source tree 26 INSTALL_LIB = $(INSTALL_BASE)/lib27 INSTALL_BIN = $(INSTALL_BASE)/bin28 INSTALL = cp29 CP = cp30 LS = /bin/ls31 28 32 29 default all: jar 33 30 check: test 34 31 35 32 install: 36 33 @test -f $(JAR) && $(MAKE) real_install \ 37 INSTALL_BASE=$( INSTALL_BASE) \38 INSTALL_LIB=$( INSTALL_LIB) \39 INSTALL_BIN=$( INSTALL_BIN) || $(WARN_NO_INSTALL)34 INSTALL_BASE=$(DESTDIR)$(INSTALL_BASE) \ 35 INSTALL_LIB=$(DESTDIR)$(INSTALL_LIB) \ 36 INSTALL_BIN=$(DESTDIR)$(INSTALL_BIN) || $(WARN_NO_INSTALL) 40 37 41 38 real_install: _always 42 39 test -d $(INSTALL_LIB) … … real_install: _always 46 43 $(CP) -R tools/. $(INSTALL_BIN) 47 44 48 45 uninstall: 49 for i in $(LIBS) ""; do test -z "$$i" || rm -f $( INSTALL_LIB)/`basename $$i`; done50 for i in `$(LS) tools` "" ; do test -z "$$i" || rm -f $( INSTALL_BIN)/`basename $$i`; done46 for i in $(LIBS) ""; do test -z "$$i" || rm -f $(DESTDIR)$(INSTALL_LIB)/`basename $$i`; done 47 for i in `$(LS) tools` "" ; do test -z "$$i" || rm -f $(DESTDIR)$(INSTALL_BIN)/`basename $$i`; done 51 48 52 49 # Use ant to actually do the work for these targets 53 50 jar test: _always