summaryrefslogtreecommitdiffstats
path: root/src/krb5_plugin
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2010-03-15 17:57:27 +0100
committerStephen Gallagher <sgallagh@redhat.com>2010-03-15 16:12:52 -0400
commitcf5f37509e0215de9fb0bd169d49c701a65de769 (patch)
treecebb0003a7fe769b1c451bdaff9976496a255d3c /src/krb5_plugin
parenteb5b6e43451d6b517947b7029dd81182aa000fa1 (diff)
downloadsssd-cf5f37509e0215de9fb0bd169d49c701a65de769.tar.gz
sssd-cf5f37509e0215de9fb0bd169d49c701a65de769.tar.xz
sssd-cf5f37509e0215de9fb0bd169d49c701a65de769.zip
Fix segfault in the locator plugin
Diffstat (limited to 'src/krb5_plugin')
-rw-r--r--src/krb5_plugin/sssd_krb5_locator_plugin.c51
1 files changed, 26 insertions, 25 deletions
diff --git a/src/krb5_plugin/sssd_krb5_locator_plugin.c b/src/krb5_plugin/sssd_krb5_locator_plugin.c
index eb8666e46..626960a2e 100644
--- a/src/krb5_plugin/sssd_krb5_locator_plugin.c
+++ b/src/krb5_plugin/sssd_krb5_locator_plugin.c
@@ -153,34 +153,35 @@ static int get_krb5info(const char *realm, struct sssd_ctx *ctx,
port_str = strrchr((char *) buf, ':');
if (port_str == NULL) {
port = 0;
- }
- *port_str = '\0';
- ++port_str;
-
- if (isdigit(*port_str)) {
- errno = 0;
- port = strtol(port_str, &endptr, 10);
- if (errno != 0) {
- ret = errno;
- PLUGIN_DEBUG(("strtol failed on [%s]: [%d][%s], "
- "assuming default.\n", port_str, ret, strerror(ret)));
- port = 0;
- }
- if (*endptr != '\0') {
- PLUGIN_DEBUG(("Found additional characters [%s] in port number "
- "[%s], assuming default.\n", endptr, port_str));
- port = 0;
- }
+ } else {
+ *port_str = '\0';
+ ++port_str;
+
+ if (isdigit(*port_str)) {
+ errno = 0;
+ port = strtol(port_str, &endptr, 10);
+ if (errno != 0) {
+ ret = errno;
+ PLUGIN_DEBUG(("strtol failed on [%s]: [%d][%s], "
+ "assuming default.\n", port_str, ret, strerror(ret)));
+ port = 0;
+ }
+ if (*endptr != '\0') {
+ PLUGIN_DEBUG(("Found additional characters [%s] in port number "
+ "[%s], assuming default.\n", endptr, port_str));
+ port = 0;
+ }
- if (port < 0 || port > 65535) {
- PLUGIN_DEBUG(("Illegal port number [%d], assuming default.\n",
- port));
+ if (port < 0 || port > 65535) {
+ PLUGIN_DEBUG(("Illegal port number [%d], assuming default.\n",
+ port));
+ port = 0;
+ }
+ } else {
+ PLUGIN_DEBUG(("Illegal port number [%s], assuming default.\n",
+ port_str));
port = 0;
}
- } else {
- PLUGIN_DEBUG(("Illegal port number [%s], assuming default.\n",
- port_str));
- port = 0;
}
switch (svc) {