summaryrefslogtreecommitdiff
path: root/source3/lib/sids.c
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1998-12-01 16:04:24 +0000
committerLuke Leighton <lkcl@samba.org>1998-12-01 16:04:24 +0000
commit67638b8d2b59dc992280af934346a5a1ef5fe62d (patch)
tree5e155440b7d3743385506526532d5a634d8c9f53 /source3/lib/sids.c
parentc6ad04b8fb4ee5cbf862a35b4c143a6f75555718 (diff)
downloadsamba-67638b8d2b59dc992280af934346a5a1ef5fe62d.tar.gz
samba-67638b8d2b59dc992280af934346a5a1ef5fe62d.tar.bz2
samba-67638b8d2b59dc992280af934346a5a1ef5fe62d.zip
adding some samr parsing calls (group / alias adding / deleting)
added code that moves MACHINE.SID to DOMAIN_NAME.SID if it exists. (This used to be commit 51c1c31768a92d9c57ee6c09b78419bcbc544f03)
Diffstat (limited to 'source3/lib/sids.c')
-rw-r--r--source3/lib/sids.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/source3/lib/sids.c b/source3/lib/sids.c
index f5fed0f656..42f6dc68e2 100644
--- a/source3/lib/sids.c
+++ b/source3/lib/sids.c
@@ -277,6 +277,7 @@ BOOL generate_sam_sid(char *domain_name)
int i;
char *p;
pstring sid_file;
+ pstring machine_sid_file;
fstring sid_string;
fstring file_name;
SMB_STRUCT_STAT st;
@@ -304,10 +305,29 @@ BOOL generate_sam_sid(char *domain_name)
}
}
+ pstrcpy(machine_sid_file, sid_file);
+ pstrcat(machine_sid_file, "MACHINE.SID");
+
slprintf(file_name, sizeof(file_name)-1, "%s.SID", domain_name);
strupper(file_name);
pstrcat(sid_file, file_name);
+ if (file_exists(machine_sid_file, NULL))
+ {
+ if (file_exists(machine_sid_file, NULL))
+ {
+ DEBUG(0,("both %s and %s exist when only one should, unable to continue\n",
+ machine_sid_file, sid_file));
+ return False;
+ }
+ if (file_rename(machine_sid_file, sid_file))
+ {
+ DEBUG(0,("could not rename %s to %s. Error was %s\n",
+ machine_sid_file, sid_file, strerror(errno)));
+ return False;
+ }
+ }
+
if ((fd = sys_open(sid_file, O_RDWR | O_CREAT, 0644)) == -1) {
DEBUG(0,("unable to open or create file %s. Error was %s\n",
sid_file, strerror(errno) ));