int rv;
int fd;
NTSTATUS status;
+ const char *file_content = "[General]\r\nVersion=0\r\n";
/* Create a forked memory context, as a base for everything here */
mem_ctx = talloc_new(gp_ctx);
return NT_STATUS_UNSUCCESSFUL;
}
- rv = write(fd, "[General]\r\nVersion=0\r\n", 23);
- if (rv != 23) {
+ rv = write(fd, file_content, strlen(file_content));
+ if (rv != strlen(file_content)) {
DEBUG(0, ("Short write in GPT.INI\n"));
talloc_free(mem_ctx);
return NT_STATUS_UNSUCCESSFUL;
int pos;
struct gp_link **gplinks;
char *buf, *end;
+ const char *gplink_start = "[LDAP://";
gplinks = talloc_array(mem_ctx, struct gp_link *, 1);
gplinks[0] = NULL;
/* Assuming every gPLink starts with "[LDAP://" */
- start = 8;
+ start = strlen(gplink_start);
for (pos = start; pos < strlen(gplink_str); pos++) {
if (gplink_str[pos] == ';') {
/* Increment the array index, the string position past
the next "[LDAP://", and set the start reference */
idx++;
- pos += 9;
+ pos += strlen(gplink_start)+1;
start = pos;
}
}