Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 160867 Details for
Bug 251262
ldap-agent needs to find slapd.stats file dynamically
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
CVS Diffs
diffs.txt (text/plain), 5.22 KB, created by
Nathan Kinder
on 2007-08-07 22:42:35 UTC
(
hide
)
Description:
CVS Diffs
Filename:
MIME Type:
Creator:
Nathan Kinder
Created:
2007-08-07 22:42:35 UTC
Size:
5.22 KB
patch
obsolete
>Index: servers/snmp/main.c >=================================================================== >RCS file: /cvs/dirsec/ldapserver/ldap/servers/snmp/main.c,v >retrieving revision 1.10 >diff -u -5 -t -r1.10 main.c >--- servers/snmp/main.c 10 Nov 2006 23:45:53 -0000 1.10 >+++ servers/snmp/main.c 7 Aug 2007 22:30:38 -0000 >@@ -237,11 +237,10 @@ > server_instance *serv_p = NULL; > FILE *conf_file = NULL; > FILE *dse_fp = NULL; > char line[MAXLINE]; > char *p = NULL; >- char *p2 = NULL; > > /* Make sure we are getting an absolute path */ > if (*conf_path != '/') { > printf("ldap-agent: Error opening config file: %s\n", conf_path); > printf("ldap-agent: You must specify the absolute path to your config file\n"); >@@ -303,49 +302,90 @@ > if ((p = strtok(p, " \t\n")) != NULL) { > if ((agent_logdir = (char *) malloc(strlen(p) + 1)) != NULL) > strcpy(agent_logdir, p); > } > } else if ((p = strstr(line, "server")) != NULL) { >+ int got_port = 0; >+ int got_tmpdir = 0; >+ > /* Allocate a server_instance */ > if ((serv_p = malloc(sizeof(server_instance))) == NULL) { > printf("ldap-agent: malloc error processing config file\n"); > exit(1); > } > > /* load server setting */ > p = p + 6; >- if ((p = strtok_r(p, " :\t\n", &p2)) != NULL) { >- /* first token is the instance root */ >- if ((serv_p->stats_file = malloc(strlen(p) + 18)) != NULL) >- snprintf(serv_p->stats_file, strlen(p) + 18, >- "%s/logs/slapd.stats", p); >- serv_p->stats_file[(strlen(p) + 17)] = (char)0; >- if ((serv_p->dse_ldif = malloc(strlen(p) + 17)) != NULL) { >- snprintf(serv_p->dse_ldif, strlen(p) + 17, "%s/config/dse.ldif", p); >- serv_p->dse_ldif[(strlen(p) + 16)] = (char)0; >+ if ((p = strtok(p, " \t\n")) != NULL) { >+ /* first token is the instance name */ >+ serv_p->dse_ldif = malloc(strlen(p) + strlen(SYSCONFDIR) + >+ strlen(PACKAGE_NAME) + 12); >+ if (serv_p->dse_ldif != NULL) { >+ snprintf(serv_p->dse_ldif, strlen(p) + strlen(SYSCONFDIR) + >+ strlen(PACKAGE_NAME) + 12, "%s/%s/%s/dse.ldif", >+ SYSCONFDIR, PACKAGE_NAME, p); >+ serv_p->dse_ldif[(strlen(p) + strlen(SYSCONFDIR) + >+ strlen(PACKAGE_NAME) + 11)] = (char)0; >+ } else { >+ printf("ldap-agent: malloc error processing config file\n"); >+ exit(1); > } > } > > /* Open dse.ldif */ > if ((dse_fp = fopen(serv_p->dse_ldif, "r")) == NULL) { > printf("ldap-agent: Error opening server config file: %s\n", > serv_p->dse_ldif); > exit(1); > } > >- /* Get port value */ >+ /* Get port and tmpdir values */ > while (fgets(line, MAXLINE, dse_fp) != NULL) { > if ((p = strstr(line, "nsslapd-port: ")) != NULL) { > p = p + 14; >- if ((p = strtok(p, ": \t\n")) != NULL) >+ if ((p = strtok(p, " \t\n")) != NULL) { > serv_p->port = atol(p); >+ } >+ got_port = 1; >+ } else if ((p=strstr(line, "nsslapd-tmpdir: ")) != NULL) { >+ p = p + 16; >+ if ((p = strtok(p, " \t\n")) != NULL) { >+ serv_p->stats_file = malloc(strlen(p) + 13); >+ if (serv_p->stats_file != NULL) { >+ snprintf(serv_p->stats_file, strlen(p) + 13, >+ "%s/slapd.stats", p); >+ serv_p->stats_file[(strlen(p) + 12)] = (char)0; >+ } else { >+ printf("ldap-agent: malloc error processing config file\n"); >+ exit(1); >+ } >+ } >+ got_tmpdir = 1; >+ } >+ >+ /* If we already got the port and tmpdir, stop >+ * reading through the dse.ldif */ >+ if (got_port && got_tmpdir) { >+ break; > } > } > > /* Close dse.ldif */ > fclose(dse_fp); > >+ /* Make sure we were able to read the port and >+ * location of the stats file. */ >+ if (!got_port) { >+ printf("ldap-agent: Error reading nsslapd-port from " >+ "server config file: %s\n", serv_p->dse_ldif); >+ exit(1); >+ } else if (!got_tmpdir) { >+ printf("ldap-agent: Error reading nsslapd-tmpdir from " >+ "server config file: %s\n", serv_p->dse_ldif); >+ exit(1); >+ } >+ > /* Insert server instance into linked list */ > serv_p->next = server_head; > server_head = serv_p; > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 251262
:
160867
|
160880