Check-in [9279433b2f]
Overview
Comment:Added initial PKI support
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tcl-ops
Files: files | file ages | folders
SHA1: 9279433b2fb2920c41245fec9642f70f27ad19f6
User & Date: rkeene on 2014-11-10 04:52:58
Other Links: branch diff | manifest | tags
Context
2014-11-10
05:02
Minor re-ordering so that FUSE things can be "near" each other check-in: f4e6b62dfb user: rkeene tags: tcl-ops
04:52
Added initial PKI support check-in: 9279433b2f user: rkeene tags: tcl-ops
04:22
More work towards getting the user multiplexing right check-in: d3bb0824ec user: rkeene tags: tcl-ops
Changes

Modified .fossil-settings/ignore-glob from [6f815d9a84] to [efc67b31c0].

1
2
3
4
5


appfsd
appfsd.o
appfsd.tcl.h
sha1.o
sha1.tcl.h







>
>
1
2
3
4
5
6
7
appfsd
appfsd.o
appfsd.tcl.h
sha1.o
sha1.tcl.h
pki.tcl.h
pki.tcl.new

Modified Makefile from [e0a242ebcc] to [d5b77089dc].

21
22
23
24
25
26
27
28
29
30
31
32
33













34
35
36
37
38
39
40
41
42
43
44
45
46
47
48

49
50
51



52
TCL_LIBS = $(shell . $(TCLCONFIG_SH_PATH); echo "$${TCL_LIB_SPEC}")

all: appfsd

appfsd: appfsd.o sha1.o
	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o appfsd appfsd.o sha1.o $(LIBS)

appfsd.o: appfsd.c appfsd.tcl.h
	$(CC) $(CPPFLAGS) $(CFLAGS) -o appfsd.o -c appfsd.c

sha1.o: sha1.c sha1.tcl.h
	$(CC) $(CPPFLAGS) $(CFLAGS) -o sha1.o -c sha1.c














%.tcl.h: %.tcl
	sed 's@[\\"]@\\&@g;s@^@   "@;s@$$@\\n"@' $^ > $@.new
	mv $@.new $@

install: appfsd appfs-cache appfs-mkfs
	if [ ! -d '$(DESTDIR)$(sbindir)' ]; then mkdir -p '$(DESTDIR)$(sbindir)'; chmod 755 '$(DESTDIR)$(sbindir)'; fi
	if [ ! -d '$(DESTDIR)$(bindir)' ]; then mkdir -p '$(DESTDIR)$(bindir)'; chmod 755 '$(DESTDIR)$(bindir)'; fi
	cp appfsd '$(DESTDIR)$(sbindir)/'
	cp appfs-cache '$(DESTDIR)$(sbindir)/'
	cp appfs-mkfs '$(DESTDIR)$(bindir)/'

clean:
	rm -f appfsd appfsd.o
	rm -f appfsd.tcl.h
	rm -f sha1.o sha1.tcl.h


distclean: clean




.PHONY: all test clean distclean install







|





>
>
>
>
>
>
>
>
>
>
>
>
>















>



>
>
>
|
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
TCL_LIBS = $(shell . $(TCLCONFIG_SH_PATH); echo "$${TCL_LIB_SPEC}")

all: appfsd

appfsd: appfsd.o sha1.o
	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o appfsd appfsd.o sha1.o $(LIBS)

appfsd.o: appfsd.c appfsd.tcl.h pki.tcl.h
	$(CC) $(CPPFLAGS) $(CFLAGS) -o appfsd.o -c appfsd.c

sha1.o: sha1.c sha1.tcl.h
	$(CC) $(CPPFLAGS) $(CFLAGS) -o sha1.o -c sha1.c

pki.tcl:
	rm -f pki.tcl.new
	curl http://core.tcl.tk/tcllib/raw/modules/asn/asn.tcl?name=aea6802a16e69c9f2d4f5eca20fdc23174609731 > pki.tcl.new
	curl http://core.tcl.tk/tcllib/raw/modules/aes/aes.tcl?name=94452b42b4ca98298ab1465c40fd87d11a40cf5e >> pki.tcl.new
	curl http://core.tcl.tk/tcllib/raw/modules/des/tcldes.tcl?name=ffea6ca6eb4468c0edef7a745b1dadc632ff5aeb >> pki.tcl.new
	curl http://core.tcl.tk/tcllib/raw/modules/des/des.tcl?name=5d8f3a7c1a6ea88ee988652643db8f06038aff49 >> pki.tcl.new
	curl http://core.tcl.tk/tcllib/raw/modules/math/bignum.tcl?name=3bc84d9b1f18c2e7360573381317c4dc9af731f9 >> pki.tcl.new
	curl http://core.tcl.tk/tcllib/raw/modules/md5/md5x.tcl?name=3cddfa803d680a79ab7dfac90edfd751f3d4fadd >> pki.tcl.new
	curl http://core.tcl.tk/tcllib/raw/modules/sha1/sha256.tcl?name=1fd001eb65e88c823b980456726079deae3512df >> pki.tcl.new
	curl 'http://core.tcl.tk/tcllib/raw/modules/pki/pki.tcl?name=8318fd31981dcc00bfadd6c427518f9d71a12b34' >> pki.tcl.new
	openssl sha1 pki.tcl.new | grep '918ddd77f485a58192b2e86230777092d790191a' >/dev/null
	mv pki.tcl.new pki.tcl

%.tcl.h: %.tcl
	sed 's@[\\"]@\\&@g;s@^@   "@;s@$$@\\n"@' $^ > $@.new
	mv $@.new $@

install: appfsd appfs-cache appfs-mkfs
	if [ ! -d '$(DESTDIR)$(sbindir)' ]; then mkdir -p '$(DESTDIR)$(sbindir)'; chmod 755 '$(DESTDIR)$(sbindir)'; fi
	if [ ! -d '$(DESTDIR)$(bindir)' ]; then mkdir -p '$(DESTDIR)$(bindir)'; chmod 755 '$(DESTDIR)$(bindir)'; fi
	cp appfsd '$(DESTDIR)$(sbindir)/'
	cp appfs-cache '$(DESTDIR)$(sbindir)/'
	cp appfs-mkfs '$(DESTDIR)$(bindir)/'

clean:
	rm -f appfsd appfsd.o
	rm -f appfsd.tcl.h
	rm -f sha1.o sha1.tcl.h
	rm -f pki.tcl.new pki.tcl.h

distclean: clean

mrproper: distclean
	rm -f pki.tcl

.PHONY: all install clean distclean mrproper

Modified appfsd.c from [d452ee8ca8] to [423ee145a2].

141
142
143
144
145
146
147



















148
149
150
151
152
153
154
			*error_string = strdup(Tcl_GetStringResult(interp));
		}

		Tcl_DeleteInterp(interp);

		return(NULL);
	}




















	/*
	 * Load the "appfsd.tcl" script, which is "compiled" into a C header
	 * so that it does not need to exist on the filesystem and can be
	 * directly evaluated.
	 */
	tcl_ret = Tcl_Eval(interp, ""







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
			*error_string = strdup(Tcl_GetStringResult(interp));
		}

		Tcl_DeleteInterp(interp);

		return(NULL);
	}

	/*
	 * Load "pki.tcl" in the same way as appfsd.tcl (see below)
	 */
	tcl_ret = Tcl_Eval(interp, ""
#include "pki.tcl.h"
	"");
	if (tcl_ret != TCL_OK) {
		fprintf(stderr, "Unable to initialize Tcl PKI.  Aborting.\n");
		fprintf(stderr, "Tcl Error is: %s\n", Tcl_GetStringResult(interp));

		if (error_string) {
			*error_string = strdup(Tcl_GetStringResult(interp));
		}

		Tcl_DeleteInterp(interp);

		return(NULL);
	}

	/*
	 * Load the "appfsd.tcl" script, which is "compiled" into a C header
	 * so that it does not need to exist on the filesystem and can be
	 * directly evaluated.
	 */
	tcl_ret = Tcl_Eval(interp, ""
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
	test_interp = appfs_create_TclInterp(&test_interp_error);
	if (test_interp == NULL) {
		if (test_interp_error == NULL) {
			test_interp_error = "Unknown error";
		}

		fprintf(stderr, "Unable to initialize Tcl interpreter for AppFSd:\n");
		fprintf(stderr, "%s", test_interp_error);

		return(1);
	}
	Tcl_DeleteInterp(test_interp);

	/*
	 * Enter the FUSE main loop -- this will process any arguments
	 * and start servicing requests.
	 */
	appfs_fuse_started = 1;
	return(fuse_main(args.argc, args.argv, &appfs_operations, NULL));
}
 







|













1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
	test_interp = appfs_create_TclInterp(&test_interp_error);
	if (test_interp == NULL) {
		if (test_interp_error == NULL) {
			test_interp_error = "Unknown error";
		}

		fprintf(stderr, "Unable to initialize Tcl interpreter for AppFSd:\n");
		fprintf(stderr, "%s\n", test_interp_error);

		return(1);
	}
	Tcl_DeleteInterp(test_interp);

	/*
	 * Enter the FUSE main loop -- this will process any arguments
	 * and start servicing requests.
	 */
	appfs_fuse_started = 1;
	return(fuse_main(args.argc, args.argv, &appfs_operations, NULL));
}
 

Modified appfsd.tcl from [af80dbf637] to [649eb3a6a1].

1
2
3
4
5
6
7

8
9
10
11
12
13
14
#! /usr/bin/env tclsh

package require http 2.7
package require sqlite3
package require sha1
package require appfsd
package require platform


namespace eval ::appfs {
	variable cachedir "/tmp/appfs-cache"
	variable ttl 3600
	variable nttl 60

	# User-replacable function to convert a hostname/hash/method to an URL







>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#! /usr/bin/env tclsh

package require http 2.7
package require sqlite3
package require sha1
package require appfsd
package require platform
package require pki

namespace eval ::appfs {
	variable cachedir "/tmp/appfs-cache"
	variable ttl 3600
	variable nttl 60

	# User-replacable function to convert a hostname/hash/method to an URL