Discussion:
[PATCH] Make the test_profile able to take multiple files
David Howells
2018-09-06 16:14:26 UTC
Permalink
Make the test_profile program able to take multiple files by sticking in
parameters called "{" and "}" around the set, e.g.:

./src/util/profile/test_profile { foo.conf bar.conf } query cells openstack.org description

The original still works, but a single file named "{" is now unusable, unless
it is sandwiched with "{" and "}".

---
diff --git a/src/util/profile/test_profile.c b/src/util/profile/test_profile.c
index 6f6fcc7..02e9d0e 100644
--- a/src/util/profile/test_profile.c
+++ b/src/util/profile/test_profile.c
@@ -115,25 +115,48 @@ int main(argc, argv)
{
profile_t profile;
long retval;
- char **values, *value, **cpp;
+ char **values, *value, **cpp, **p;
const char **names;
char *cmd;
int print_value = 0;

if (argc < 2) {
fprintf(stderr, "Usage: %s filename [cmd argset]\n", program_name);
+ fprintf(stderr, " %s { filename* } [cmd argset]\n", program_name);
exit(1);
}

initialize_prof_error_table();

- retval = profile_init_path(argv[1], &profile);
- if (retval) {
- com_err(program_name, retval, "while initializing profile");
- exit(1);
+ if (strcmp(argv[1], "{") != 0) {
+ retval = profile_init_path(argv[1], &profile);
+ if (retval) {
+ com_err(program_name, retval, "while initializing profile");
+ exit(1);
+ }
+ cmd = *(argv+2);
+ names = (const char **) argv+3;
+ } else {
+ for (p = argv + 1; *p; p++)
+ if (strcmp(*p, "}") == 0)
+ break;
+ if (!p[0]) {
+ fprintf(stderr, "Missing closure of filename set.\n");
+ exit(1);
+ }
+ if (!p[1]) {
+ fprintf(stderr, "Missing command name.\n");
+ exit(1);
+ }
+ *p = NULL;
+ retval = profile_init((const char **)argv + 1, &profile);
+ if (retval) {
+ com_err(program_name, retval, "while initializing profile");
+ exit(1);
+ }
+ cmd = p[1];
+ names = (const char **) p + 2;
}
- cmd = *(argv+2);
- names = (const char **) argv+3;
if (!cmd || !strcmp(cmd, "batch"))
do_batchmode(profile);
if (!strcmp(cmd, "query")) {

_______________________________________________
krbdev mailing list ***@mit.edu
https://mailman.mit.edu/mailman/listinfo/krbdev
Greg Hudson
2018-09-06 17:19:02 UTC
Permalink
Post by David Howells
Make the test_profile program able to take multiple files by sticking in
If it is convenient for you to submit a pull request for this at
https://github.com/krb5/krb5 , please do so; otherwise I can file it.

Also, since we don't install test_profile and only build it as part of
"make check", I would like to know more about the motivation for this
improvement.
_______________________________________________
krbdev mailing list ***@mit.edu
https://mailman.mit.edu/mailman/listinfo/krbdev
David Howells
2018-09-06 20:04:13 UTC
Permalink
Post by Greg Hudson
Post by David Howells
Make the test_profile program able to take multiple files by sticking in
If it is convenient for you to submit a pull request for this at
https://github.com/krb5/krb5 , please do so; otherwise I can file it.
I'll have a look at it next week. I haven't really used github before, so I'm
not sure if there's anything special I need to do for it.
Post by Greg Hudson
Also, since we don't install test_profile and only build it as part of "make
check", I would like to know more about the motivation for this improvement.
I'm preparing a kafs-client package so that the in-Linux-kernel AFS client
that I've written can load its configuration from a set of kerberos-style
cells database files on boot.

https://www.infradead.org/~dhowells/kafs/

I'm trying to understand how intersections between overlapping objects works
within a config file and between "stacked" config files.

One of the problems I have is that MIT Kerberos isn't available on all Linux
distributions, so I'll need to use something different on those - but as I
understand it, the parser behaviour isn't consistent between different
implementations.

David
_______________________________________________
krbdev mailing list ***@mit.edu
https://mailman.mit.edu/mailman/listinfo/krbdev
Chris Hecker
2018-09-07 06:20:01 UTC
Permalink
Having just learned this GitHub pull request thing, this page was very
helpful:

https://k5wiki.kerberos.org/wiki/Maintaining_a_github_fork

The one thing to note is where they use "mangos" make sure you use a name
that makes sense for your patch, like test-multi or whatever. I'm going to
edit the page to be more clear about that when I get a chance.

Chris
Post by David Howells
Post by Greg Hudson
Post by David Howells
Make the test_profile program able to take multiple files by sticking
in
Post by Greg Hudson
If it is convenient for you to submit a pull request for this at
https://github.com/krb5/krb5 , please do so; otherwise I can file it.
I'll have a look at it next week. I haven't really used github before, so I'm
not sure if there's anything special I need to do for it.
Post by Greg Hudson
Also, since we don't install test_profile and only build it as part of
"make
Post by Greg Hudson
check", I would like to know more about the motivation for this
improvement.
I'm preparing a kafs-client package so that the in-Linux-kernel AFS client
that I've written can load its configuration from a set of kerberos-style
cells database files on boot.
https://www.infradead.org/~dhowells/kafs/
I'm trying to understand how intersections between overlapping objects works
within a config file and between "stacked" config files.
One of the problems I have is that MIT Kerberos isn't available on all Linux
distributions, so I'll need to use something different on those - but as I
understand it, the parser behaviour isn't consistent between different
implementations.
David
_______________________________________________
https://mailman.mit.edu/mailman/listinfo/krbdev
_______________________________________________
krbdev mailing list ***@mit.edu
https://mailman.mit.edu/mailman/listinfo/krbdev

Continue reading on narkive:
Loading...