[PATCH] Fix $PROCESS in init script after name change.
by russell@russellbryant.net
I haven't tested this script fully yet. I've been running things manually
and now I'm trying to build RPMs and start everything as services but
I'm having some problems. I noticed this while debugging it.
I still need to figure out why /var/lib/matahari and /var/run/matahari
don't seem to be created properly when installing the RPMs though.
I'm using Fedora 15.
-----
matahari-serviced is now matahari-qmf-serviced, so tweak the init script
to match that naming scheme.
Signed-off-by: Russell Bryant <russell(a)russellbryant.net>
---
matahari.init.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/matahari.init.in b/matahari.init.in
index c967b8d..ed34c4b 100644
--- a/matahari.init.in
+++ b/matahari.init.in
@@ -23,7 +23,7 @@
SERVICE=`readlink -f "$0"`
SERVICE=`basename "$SERVICE"`
-PROCESS=`echo "$SERVICE"d`
+PROCESS=`echo "$SERVICE" | cut -f1 -d'-'`-qmf-`echo "$SERVICE" | cut -f2 -d'-'`d
RETVAL=0
--
1.7.4.4
13 years
qpid ssl environment var's
by Adam Stokes
little history..
QPID_SSL_CERT_DB and QPID_SSL_CERT_PASSWORD_FILE need to be set in order to make the broker load the sslconnector library and provide us with SSL capabilities during communication. Unfortunately, there is no command level way to set these options and so we are looking at alternatives.
So far:
1) setting the variables QPID_SSL_CERT_DB and QPID_SSL_CERT_PASSWORD_FILE with setenv() prior to making the amqp connection. The broker failed to see variables
2) Placing them in /etc/qpid/qpidc.conf, I thought this may work but did not have luck. There is code for checking at least the cert database in qpid.
3) Prior to running any agents, brokers, prepend QPID_SSL_CERT_DB and QPID_SSL_CERT_PASSWORD_FILE on the commandline. works.
Other options may be to set them in an initscript or maybe some configuration items in our own matahari.conf
thoughts?
--
__ __
.-----.| |_.-----.| |--.-----.-----.
|__ --|| _| _ || <| -__|__ --|
|_____||____|_____||__|__|_____|_____|
.----------------------------------.
( ajs(a)redhat.com || 919.754.4187 )
`----------------------------------'
13 years
asprintf changes
by Andrew Beekhof
commit cd96dcdd620e08c879d91bea895432e1d6394360
Author: Russell Bryant <russell(a)russellbryant.net>
Date: Sat Mar 26 14:04:18 2011 -0500
Misc cleanups in src/lib/services.c.
...
3) Use asprintf() instead of a malloc() + snprintf().
We'll have to revert this I'm afraid... asprintf() isn't available
when cross compiling.
Not really your fault, we haven't been able to cross compile on fedora
for a while (fixed now).
-- Andrew
13 years
Build and organizational improvements
by Andrew Beekhof
Some changes I've been meaning to make for a while now.
- All files are now named consistently, both between dbus and qmf
as well as wrt. their directory and library names
- I also made the per-agent CMake files more cut&paste friendly
- Fixed the spec file now that DBus is built by default
- Made building with(out) dbus and qmf possible
The package structure may still change somewhat. It depends on
how the conversation with SELinux goes (and therefor how many
daemons we end up with).
For now dbus binaries are in with their equivalent qmf agent.
[PATCH 1/8] Build: Streamline CMake control files and remove QMFv1 related artifacts
[PATCH 2/8] Use a consistent naming standard between dbus and qmf
[PATCH 3/8] Build: Update the spec file for recent name and packaging changes
[PATCH 4/8] Build: Force the use of a fedora version with working qpid packages when using mock
[PATCH 5/8] Windows: Fix install script
[PATCH 6/8] Build: Make building rpms with dbus support optional
[PATCH 7/8] Build: Make building rpms with qmf support optional
[PATCH 8/8] Build: Support --with(out) when building packages with mock
13 years
[PATCH] Check for NULL mainloop_process_table
by Angus Salkeld
When running a resource start/monitor with a timeout of 0 (blocking)
we are not using the "managed child process" code. So we end up in
child_death_dispatch() with a NULL process_table - as it wasn't added in
services_os_action_execute(). We could mask out this signal but
there might be other managed processes. So this is a simple solution.
Can you port to rhel6 please?
Signed-off-by: Angus Salkeld <asalkeld(a)redhat.com>
---
src/lib/mainloop.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/lib/mainloop.c b/src/lib/mainloop.c
index 7cc27e7..6a67c05 100644
--- a/src/lib/mainloop.c
+++ b/src/lib/mainloop.c
@@ -431,6 +431,9 @@ child_death_dispatch(int sig)
if (pid > 0) {
int signo = 0, exitcode = 0;
+ if (mainloop_process_table == NULL) {
+ continue;
+ }
mainloop_child_t *p = g_hash_table_lookup(mainloop_process_table, GINT_TO_POINTER(pid));
mh_trace("Managed process %d exited: %p", pid, p);
if (p == NULL) {
--
1.7.4.4
13 years
[PATCH] SSL options
by Adam Stokes
From: Adam Stokes <astokes(a)fedoraproject.org>
- Provide matahari agents ability to enable SSL communication with their brokers.
- Allow agents to define the the certificate name defined during the signing process from certificate authority
- Keep in mind that ssl-cert-name is the only available option connection level and that a certificate database and password file need to be defined with
QPID_SSL_CERT_DB
QPID_SSL_CERT_PASSWORD_FILE
Also note that in order to glue all this together the agents will need to make sure that the sslconnector module is loaded
export QPID_LOAD_MODULE=/path/to/sslconnector.so (/usr/lib{64}/qpid/client/sslconnector.so)
---
src/lib/mh_agent.cpp | 42 ++++++++++++++++++++++++++++++++----------
1 files changed, 32 insertions(+), 10 deletions(-)
diff --git a/src/lib/mh_agent.cpp b/src/lib/mh_agent.cpp
index d8f8417..67fd53f 100644
--- a/src/lib/mh_agent.cpp
+++ b/src/lib/mh_agent.cpp
@@ -91,6 +91,8 @@ struct option opt[] = {
{"password", required_argument, NULL, 'P'},
{"service", required_argument, NULL, 's'},
{"port", required_argument, NULL, 'p'},
+ {"ssl", no_argument, NULL, 'S'},
+ {"ssl-cert-name", required_argument, NULL, 'N'},
{0, 0, 0, 0}
};
@@ -98,14 +100,16 @@ static void
print_usage(const char *proc_name)
{
printf("Usage:\tmatahari-%sd <options>\n", proc_name);
- printf("\t-d | --daemon run as a daemon.\n");
- printf("\t-h | --help print this help message.\n");
- printf("\t-b | --broker specify broker host name..\n");
- printf("\t-g | --gssapi force GSSAPI authentication.\n");
- printf("\t-u | --username username to use for authentication purproses.\n");
- printf("\t-P | --password password to use for authentication purproses.\n");
- printf("\t-s | --service service name to use for authentication purproses.\n");
- printf("\t-p | --port specify broker port.\n");
+ printf("\t-d | --daemon run as a daemon.\n");
+ printf("\t-h | --help print this help message.\n");
+ printf("\t-b | --broker specify broker host name..\n");
+ printf("\t-g | --gssapi force GSSAPI authentication.\n");
+ printf("\t-u | --username username to use for authentication purproses.\n");
+ printf("\t-P | --password password to use for authentication purproses.\n");
+ printf("\t-s | --service service name to use for authentication purproses.\n");
+ printf("\t-p | --port specify broker port.\n");
+ printf("\t-S | --ssl enable ssl\n");
+ printf("\t-N | --ssl-cert-name specify certificate name.\n");
}
#endif
@@ -140,10 +144,12 @@ MatahariAgent::init(int argc, char **argv, const char* proc_name)
#endif
bool gssapi = false;
+ char *protocol = strdup("tcp");
char *servername = NULL;
char *username = NULL;
char *password = NULL;
char *service = NULL;
+ char *ssl_cert_name = NULL;
int serverport = MATAHARI_PORT;
int res = 0;
@@ -201,7 +207,7 @@ MatahariAgent::init(int argc, char **argv, const char* proc_name)
#else
// Get args
- while ((arg = getopt_long(argc, argv, "hdb:gu:P:s:p:v", opt, &idx)) != -1) {
+ while ((arg = getopt_long(argc, argv, "hdb:gu:P:s:p:vSN:", opt, &idx)) != -1) {
switch (arg) {
case 'h':
case '?':
@@ -258,6 +264,17 @@ MatahariAgent::init(int argc, char **argv, const char* proc_name)
exit(1);
}
break;
+ case 'S':
+ protocol = strdup("ssl");
+ break;
+ case 'N':
+ if (optarg) {
+ ssl_cert_name = strdup(optarg);
+ } else {
+ print_usage(proc_name);
+ exit(1);
+ }
+ break;
default:
fprintf(stderr, "unsupported option '-%c'. See --help.\n", arg);
print_usage(proc_name);
@@ -301,9 +318,12 @@ MatahariAgent::init(int argc, char **argv, const char* proc_name)
if (gssapi) {
options["sasl-mechanism"] = "GSSAPI";
}
+ if (ssl_cert_name) {
+ options["ssl-cert-name"] = ssl_cert_name;
+ }
std::stringstream url;
- url << servername << ":" << serverport ;
+ url << "amqp:" << protocol << ":" << servername << ":" << serverport ;
_amqp_connection = qpid::messaging::Connection(url.str(), options);
_amqp_connection.open();
@@ -332,6 +352,8 @@ return_cleanup:
free(username);
free(password);
free(service);
+ free(ssl_cert_name);
+ free(protocol);
return res;
}
--
1.7.4.4
13 years
[PATCH 1/2] Add more items to the coding guidelines.
by russell@russellbryant.net
1) Add note on line length.
2) Add guidelines about pointer formatting.
3) Add guidelines on function declarations.
4) Note that C types must also begin with "mh_".
5) Add a section with recommended vim settings.
Signed-off-by: Russell Bryant <russell(a)russellbryant.net>
---
doc/coding_guidelines.txt | 58 +++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 56 insertions(+), 2 deletions(-)
diff --git a/doc/coding_guidelines.txt b/doc/coding_guidelines.txt
index 44bec11..6e9b822 100644
--- a/doc/coding_guidelines.txt
+++ b/doc/coding_guidelines.txt
@@ -12,6 +12,7 @@
1) Introduction
2) Formatting Guidelines
3) Naming Conventions
+ 4) vim Settings
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
@@ -30,7 +31,44 @@ code that will be a part of the Matahari project.
--- 2) Formatting Guidelines
-------------------------------------------------------------------------------
-a) Indentatation is 4 spaces, no tabs.
+a) Whitespace
+
+ - Indentation must be 4 spaces, no tabs.
+
+ - Do not leave trailing whitespace.
+
+b) Line Length
+
+ - Lines should be no longer than 80 characters unless limiting line length
+ significantly impacts readability.
+
+b) Pointers
+
+ - The '*' goes by the variable name, not the type:
+
+ char *foo;
+
+ - Use a space before the '*' and after the closing parenthesis in a cast:
+
+ char *foo = (char *) bar;
+
+c) Functions
+
+ - Put the return type on the same line as the function name:
+
+ static int foo(void);
+
+ - Place the opening brace for a function on the next line:
+
+ static int foo(void)
+ {
+
+ - For functions with multiple arguments, use 2 tabs (8 spaces) of
+ indentation for additional arguments after the first line break.
+
+ static int foo(int bar, const char *a, const char *b,
+ const char *c, const char *d)
+ {
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
@@ -39,7 +77,23 @@ a) Indentatation is 4 spaces, no tabs.
--- 3) Naming Conventions
-------------------------------------------------------------------------------
-a) Public C API calls must begin with "mh_".
+a) Public C API calls and type names must begin with "mh_".
+
+-------------------------------------------------------------------------------
+-------------------------------------------------------------------------------
+
+-------------------------------------------------------------------------------
+--- 4) vim Settings
+-------------------------------------------------------------------------------
+
+" This section contains settings that can be placed in the vimrc file that are
+" compatible with the Matahari coding guidelines.
+
+" Whitespace
+set ts=4
+set sw=4
+set expandtab
+let c_space_error=1
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
--
1.7.4.4
13 years
[PATCH 0/2] more coding guidelines, update mainloop.c
by russell@russellbryant.net
I started to go update the rest of the APIs to have a "mh_" prefix,
but got sidetracked with mainloop.c. That was the first API I went to
and I noticed it has some formatting issues that I wanted to get out of
the way before I made code changes.
The first patch adds items to the coding guidelines document to make sure
I had captured the formatting changes I was making in the form of
guidelines for the code base. Please let me know if you don't agree
with any of them.
[PATCH 1/2] Add more items to the coding guidelines.
The second patch is only formatting changes addressing items covered
in the coding guidelines document.
[PATCH 2/2] mainloop.c: Formatting changes.
After that I'll get back to finishing applying the "mh_" naming convention.
Thanks,
--
Russell Bryant
13 years
[PATCH 0/2] Proposal for public C API call naming convention
by russell@russellbryant.net
These changes propose that a naming convention be adopted for public
C API calls. In this particular patch, the prefix of "mh_" is proposed.
However, there is also code that uses "matahari_" as a prefix. I like
"mh_" since it's shorter, but don't really care what it is. The main
point is to just to propose that a common prefix be adopted.
[PATCH 1/2] Add a naming conventions section to coding guidelines.
[PATCH 2/2] Convert host API to use mh_ prefix.
--
Russell Bryant
13 years
[PATCH 0/5] More documentation, build system tweak
by russell@russellbryant.net
Here's another batch of changes. The first is a simple build system tweak
that I like, but others might prefer not have as the default:
[PATCH 1/5] Turn verbose makefiles off by default.
We had a discussion recently about using Signed-off-by: and other such tags
in commit messages, so I have attempted to capture that in documentation
and add it to the doxygen docs, as well.
[PATCH 2/5] Add commit message guidelines.
[PATCH 3/5] Add commit message info to the doxygen docs.
I have also created a file to start covering coding guidelines to help
keep formatting consistent and other such things. There's not much content
yet. This is automatically included in the doxygen docs, as well.
[PATCH 4/5] Add coding guidelines doc.
[PATCH 5/5] Add coding guidelines to doxygen.
Thanks,
--
Russell Bryant
13 years