- #include "config.h"
- #include "ldapaddressbook.h"
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- int ldapabook_add(const char *f, const struct ldapabook *a)
- {
- FILE *fp=fopen(f, "a");
- if (!fp) return (-1);
- fprintf(fp, "%st%st%st%st%st%sn", a->name, a->host, a->port,
- a->suffix, a->binddn, a->bindpw);
- if (fflush(fp) || fclose(fp))
- {
- fclose(fp);
- return (-1);
- }
- return (0);
- }