int VerifyMount(EvalContext *ctx, char *name, Attributes a, Promise *pp) { char comm[CF_BUFSIZE], line[CF_BUFSIZE]; FILE *pfp; char *host, *rmountpt, *mountpt, *opts=NULL; host = a.mount.mount_server; rmountpt = a.mount.mount_source; mountpt = name; /* Check for options required for this mount - i.e., -o ro,rsize, etc. */ if (a.mount.mount_options) { opts = Rlist2String(a.mount.mount_options, ","); } else { opts = xstrdup(VMOUNTOPTS[VSYSTEMHARDCLASS]); } if (!DONTDO) { snprintf(comm, CF_BUFSIZE, "%s -o %s %s:%s %s", CommandArg0(VMOUNTCOMM[VSYSTEMHARDCLASS]), opts, host, rmountpt, mountpt); if ((pfp = cf_popen(comm, "r", true)) == NULL) { Log(LOG_LEVEL_ERR, "Failed to open pipe from %s", CommandArg0(VMOUNTCOMM[VSYSTEMHARDCLASS])); return 0; } ssize_t res = CfReadLine(line, CF_BUFSIZE, pfp); if (res == -1) { Log(LOG_LEVEL_ERR, "Unable to read output of mount command. (fread: %s)", GetErrorStr()); cf_pclose(pfp); return 0; } if (res != 0 && ((strstr(line, "busy")) || (strstr(line, "Busy")))) { cfPS(ctx, LOG_LEVEL_INFO, PROMISE_RESULT_INTERRUPTED, pp, a, "The device under %s cannot be mounted\n", mountpt); cf_pclose(pfp); return 1; } cf_pclose(pfp); } /* Since opts is either Rlist2String or xstrdup'd, we need to always free it */ free(opts); cfPS(ctx, LOG_LEVEL_INFO, PROMISE_RESULT_CHANGE, pp, a, "Mounting %s to keep promise\n", mountpt); return 0; }
int VerifyMount(char *name, Attributes a, Promise *pp) { char comm[CF_BUFSIZE], line[CF_BUFSIZE]; FILE *pfp; char *host, *rmountpt, *mountpt, *opts=NULL; host = a.mount.mount_server; rmountpt = a.mount.mount_source; mountpt = name; /* Check for options required for this mount - i.e., -o ro,rsize, etc. */ if (a.mount.mount_options) { opts = Rlist2String(a.mount.mount_options, ","); } else { opts = xstrdup(VMOUNTOPTS[VSYSTEMHARDCLASS]); } if (!DONTDO) { snprintf(comm, CF_BUFSIZE, "%s -o %s %s:%s %s", GetArg0(VMOUNTCOMM[VSYSTEMHARDCLASS]), opts, host, rmountpt, mountpt); if ((pfp = cf_popen(comm, "r")) == NULL) { CfOut(cf_error, "", " !! Failed to open pipe from %s\n", GetArg0(VMOUNTCOMM[VSYSTEMHARDCLASS])); return 0; } if (CfReadLine(line, CF_BUFSIZE, pfp) == -1) { FatalError("Error in CfReadLine"); } if ((strstr(line, "busy")) || (strstr(line, "Busy"))) { cfPS(cf_inform, CF_INTERPT, "", pp, a, " !! The device under %s cannot be mounted\n", mountpt); cf_pclose(pfp); return 1; } cf_pclose(pfp); } /* Since opts is either Rlist2String or xstrdup'd, we need to always free it */ free(opts); cfPS(cf_inform, CF_CHG, "", pp, a, " -> Mounting %s to keep promise\n", mountpt); return 0; }
int VerifyNotInFstab(char *name, Attributes a, Promise *pp) /* Ensure filesystem is NOT in fstab, and return no of changes */ { char regex[CF_BUFSIZE]; char *host, *mountpt, *opts; Item *ip; if (!FSTABLIST) { if (!LoadFileAsItemList(&FSTABLIST, VFSTAB[VSYSTEMHARDCLASS], a, pp)) { CfOut(cf_error, "", "Couldn't open %s!\n", VFSTAB[VSYSTEMHARDCLASS]); return false; } else { FSTAB_EDITS = 0; } } if (a.mount.mount_options) { opts = Rlist2String(a.mount.mount_options, ","); } else { opts = xstrdup(VMOUNTOPTS[VSYSTEMHARDCLASS]); } host = a.mount.mount_server; mountpt = name; if (MatchFSInFstab(mountpt)) { if (a.mount.editfstab) { #if defined(_AIX) FILE *pfp; char line[CF_BUFSIZE], aixcomm[CF_BUFSIZE]; snprintf(aixcomm, CF_BUFSIZE, "/usr/sbin/rmnfsmnt -f %s", mountpt); if ((pfp = cf_popen(aixcomm, "r")) == NULL) { cfPS(cf_error, CF_FAIL, "", pp, a, "Failed to invoke /usr/sbin/rmnfsmnt to edit fstab"); return 0; } while (!feof(pfp)) { if (CfReadLine(line, CF_BUFSIZE, pfp) == -1) { FatalError("Error in CfReadLine"); } if (line[0] == '#') { continue; } if (strstr(line, "busy")) { cfPS(cf_inform, CF_INTERPT, "", pp, a, "The device under %s cannot be removed from %s\n", mountpt, VFSTAB[VSYSTEMHARDCLASS]); return 0; } } cf_pclose(pfp); return 0; /* ignore internal editing for aix , always returns 0 changes */ #else snprintf(regex, CF_BUFSIZE, ".*[\\s]+%s[\\s]+.*", mountpt); for (ip = FSTABLIST; ip != NULL; ip = ip->next) { if (FullTextMatch(regex, ip->name)) { cfPS(cf_inform, CF_CHG, "", pp, a, "Deleting file system mounted on %s.\n", host); // Check host name matches too? DeleteThisItem(&FSTABLIST, ip); FSTAB_EDITS++; } } #endif } } if (a.mount.mount_options) { free(opts); } return 0; }
int VerifyInFstab(char *name, Attributes a, Promise *pp) /* Ensure filesystem IS in fstab, and return no of changes */ { char fstab[CF_BUFSIZE]; char *host, *rmountpt, *mountpt, *fstype, *opts; if (!FSTABLIST) { if (!LoadFileAsItemList(&FSTABLIST, VFSTAB[VSYSTEMHARDCLASS], a, pp)) { CfOut(cf_error, "", "Couldn't open %s!\n", VFSTAB[VSYSTEMHARDCLASS]); return false; } else { FSTAB_EDITS = 0; } } if (a.mount.mount_options) { opts = Rlist2String(a.mount.mount_options, ","); } else { opts = xstrdup(VMOUNTOPTS[VSYSTEMHARDCLASS]); } host = a.mount.mount_server; rmountpt = a.mount.mount_source; mountpt = name; fstype = a.mount.mount_type; #if defined(__QNX__) || defined(__QNXNTO__) snprintf(fstab, CF_BUFSIZE, "%s:%s \t %s %s\t%s 0 0", host, rmountpt, mountpt, fstype, opts); #elif defined(_CRAY) char fstype_upper[CF_BUFSIZE]; strlcpy(fstype_upper, fstype, CF_BUFSIZE); ToUpperStrInplace(fstype_upper); snprintf(fstab, CF_BUFSIZE, "%s:%s \t %s %s\t%s", host, rmountpt, mountpt, fstype_upper, opts); break; #elif defined(__hpux) snprintf(fstab, CF_BUFSIZE, "%s:%s %s \t %s \t %s 0 0", host, rmountpt, mountpt, fstype, opts); #elif defined(_AIX) snprintf(fstab, CF_BUFSIZE, "%s:\n\tdev\t= %s\n\ttype\t= %s\n\tvfs\t= %s\n\tnodename\t= %s\n\tmount\t= true\n\toptions\t= %s\n\taccount\t= false\n", mountpt, rmountpt, fstype, fstype, host, opts); #elif defined(__linux__) snprintf(fstab, CF_BUFSIZE, "%s:%s \t %s \t %s \t %s", host, rmountpt, mountpt, fstype, opts); #elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD__) snprintf(fstab, CF_BUFSIZE, "%s:%s \t %s \t %s \t %s 0 0", host, rmountpt, mountpt, fstype, opts); #elif defined(__sun) || defined(sco) || defined(__SCO_DS) snprintf(fstab, CF_BUFSIZE, "%s:%s - %s %s - yes %s", host, rmountpt, mountpt, fstype, opts); #elif defined(__CYGWIN__) snprintf(fstab, CF_BUFSIZE, "/bin/mount %s:%s %s", host, rmountpt, mountpt); #endif CfOut(cf_verbose, "", "Verifying %s in %s\n", mountpt, VFSTAB[VSYSTEMHARDCLASS]); if (!MatchFSInFstab(mountpt)) { AppendItem(&FSTABLIST, fstab, NULL); FSTAB_EDITS++; cfPS(cf_inform, CF_CHG, "", pp, a, "Adding file system %s:%s seems to %s.\n", host, rmountpt, VFSTAB[VSYSTEMHARDCLASS]); } free(opts); return 0; }
int VerifyInFstab(char *name, Attributes a, Promise *pp) /* Ensure filesystem IS in fstab, and return no of changes */ { char fstab[CF_BUFSIZE]; char *host, *rmountpt, *mountpt, *fstype, *opts; if (!FSTABLIST) { if (!LoadFileAsItemList(&FSTABLIST, VFSTAB[VSYSTEMHARDCLASS], a, pp)) { CfOut(cf_error, "", "Couldn't open %s!\n", VFSTAB[VSYSTEMHARDCLASS]); return false; } else { FSTAB_EDITS = 0; } } if (a.mount.mount_options) { opts = Rlist2String(a.mount.mount_options, ","); } else { opts = xstrdup(VMOUNTOPTS[VSYSTEMHARDCLASS]); } host = a.mount.mount_server; rmountpt = a.mount.mount_source; mountpt = name; fstype = a.mount.mount_type; switch (VSYSTEMHARDCLASS) { case qnx: snprintf(fstab, CF_BUFSIZE, "%s:%s \t %s %s\t%s 0 0", host, rmountpt, mountpt, fstype, opts); break; case crayos: { char fstype_upper[CF_BUFSIZE]; strlcpy(fstype_upper, fstype, CF_BUFSIZE); ToUpperStrInplace(fstype_upper); snprintf(fstab, CF_BUFSIZE, "%s:%s \t %s %s\t%s", host, rmountpt, mountpt, fstype_upper, opts); break; } case hp: snprintf(fstab, CF_BUFSIZE, "%s:%s %s \t %s \t %s 0 0", host, rmountpt, mountpt, fstype, opts); break; case aix: snprintf(fstab, CF_BUFSIZE, "%s:\n\tdev\t= %s\n\ttype\t= %s\n\tvfs\t= %s\n\tnodename\t= %s\n\tmount\t= true\n\toptions\t= %s\n\taccount\t= false\n", mountpt, rmountpt, fstype, fstype, host, opts); break; case linuxx: snprintf(fstab, CF_BUFSIZE, "%s:%s \t %s \t %s \t %s", host, rmountpt, mountpt, fstype, opts); break; case netbsd: case openbsd: case dragonfly: case freebsd: snprintf(fstab, CF_BUFSIZE, "%s:%s \t %s \t %s \t %s 0 0", host, rmountpt, mountpt, fstype, opts); break; case unix_sv: case solaris: snprintf(fstab, CF_BUFSIZE, "%s:%s - %s %s - yes %s", host, rmountpt, mountpt, fstype, opts); break; case cfnt: snprintf(fstab, CF_BUFSIZE, "/bin/mount %s:%s %s", host, rmountpt, mountpt); break; case cfsco: CfOut(cf_error, "", "Don't understand filesystem format on SCO, no data - please fix me"); break; default: free(opts); return false; } CfOut(cf_verbose, "", "Verifying %s in %s\n", mountpt, VFSTAB[VSYSTEMHARDCLASS]); if (!MatchFSInFstab(mountpt)) { AppendItem(&FSTABLIST, fstab, NULL); FSTAB_EDITS++; cfPS(cf_inform, CF_CHG, "", pp, a, "Adding file system %s:%s seems to %s.\n", host, rmountpt, VFSTAB[VSYSTEMHARDCLASS]); } free(opts); return 0; }
static PromiseResult VerifyMountPromise(EvalContext *ctx, char *name, Attributes a, Promise *pp) { char *options; char dir[CF_BUFSIZE]; int changes = 0; Log(LOG_LEVEL_VERBOSE, "Verifying mounted file systems on '%s'", name); snprintf(dir, CF_BUFSIZE, "%s/.", name); if (!IsPrivileged()) { cfPS(ctx, LOG_LEVEL_ERR, PROMISE_RESULT_INTERRUPTED, pp, a, "Only root can mount filesystems"); return PROMISE_RESULT_INTERRUPTED; } options = Rlist2String(a.mount.mount_options, ","); PromiseResult result = PROMISE_RESULT_NOOP; if (!FileSystemMountedCorrectly(GetGlobalMountedFSList(), name, a)) { if (!a.mount.unmount) { if (!MakeParentDirectory(dir, a.move_obstructions)) { } if (a.mount.editfstab) { changes += VerifyInFstab(ctx, name, a, pp, &result); } else { cfPS(ctx, LOG_LEVEL_INFO, PROMISE_RESULT_FAIL, pp, a, "Filesystem '%s' was not mounted as promised, and no edits were promised in '%s'", name, VFSTAB[VSYSTEMHARDCLASS]); result = PromiseResultUpdate(result, PROMISE_RESULT_FAIL); // Mount explicitly result = PromiseResultUpdate(result, VerifyMount(ctx, name, a, pp)); } } else { if (a.mount.editfstab) { changes += VerifyNotInFstab(ctx, name, a, pp, &result); } } if (changes) { CF_MOUNTALL = true; } } else { if (a.mount.unmount) { VerifyUnmount(ctx, name, a, pp); if (a.mount.editfstab) { VerifyNotInFstab(ctx, name, a, pp, &result); } } else { cfPS(ctx, LOG_LEVEL_INFO, PROMISE_RESULT_NOOP, pp, a, "Filesystem '%s' seems to be mounted as promised", name); } } free(options); return result; }
static void ThisAgentInit(void) { AddGoalsToDB(Rlist2String(GOALS, ",")); SHOWREPORTS = false; }
static int VerifyMountPromise(EvalContext *ctx, char *name, Attributes a, Promise *pp) { char *options; char dir[CF_BUFSIZE]; int changes = 0; CfOut(OUTPUT_LEVEL_VERBOSE, "", " -> Verifying mounted file systems on %s\n", name); snprintf(dir, CF_BUFSIZE, "%s/.", name); if (!IsPrivileged()) { cfPS(ctx, OUTPUT_LEVEL_ERROR, PROMISE_RESULT_INTERRUPTED, "", pp, a, "Only root can mount filesystems.\n"); return false; } options = Rlist2String(a.mount.mount_options, ","); if (!FileSystemMountedCorrectly(MOUNTEDFSLIST, name, options, a)) { if (!a.mount.unmount) { if (!MakeParentDirectory(dir, a.move_obstructions)) { } if (a.mount.editfstab) { changes += VerifyInFstab(ctx, name, a, pp); } else { cfPS(ctx, OUTPUT_LEVEL_INFORM, PROMISE_RESULT_FAIL, "", pp, a, " -> Filesystem %s was not mounted as promised, and no edits were promised in %s\n", name, VFSTAB[VSYSTEMHARDCLASS]); // Mount explicitly VerifyMount(ctx, name, a, pp); } } else { if (a.mount.editfstab) { changes += VerifyNotInFstab(ctx, name, a, pp); } } if (changes) { CF_MOUNTALL = true; } } else { if (a.mount.unmount) { VerifyUnmount(ctx, name, a, pp); if (a.mount.editfstab) { VerifyNotInFstab(ctx, name, a, pp); } } else { cfPS(ctx, OUTPUT_LEVEL_INFORM, PROMISE_RESULT_NOOP, "", pp, a, " -> Filesystem %s seems to be mounted as promised\n", name); } } free(options); return true; }
static int VerifyMountPromise(char *name, Attributes a, Promise *pp, const ReportContext *report_context) { char *options; char dir[CF_BUFSIZE]; int changes = 0; CfOut(cf_verbose, "", " -> Verifying mounted file systems on %s\n", name); snprintf(dir, CF_BUFSIZE, "%s/.", name); if (!IsPrivileged()) { cfPS(cf_error, CF_INTERPT, "", pp, a, "Only root can mount filesystems.\n"); return false; } options = Rlist2String(a.mount.mount_options, ","); if (!FileSystemMountedCorrectly(MOUNTEDFSLIST, name, options, a, pp)) { if (!a.mount.unmount) { if (!MakeParentDirectory(dir, a.move_obstructions, report_context)) { } if (a.mount.editfstab) { changes += VerifyInFstab(name, a, pp); } else { cfPS(cf_inform, CF_FAIL, "", pp, a, " -> Filesystem %s was not mounted as promised, and no edits were promised in %s\n", name, VFSTAB[VSYSTEMHARDCLASS]); // Mount explicitly VerifyMount(name, a, pp); } } else { if (a.mount.editfstab) { changes += VerifyNotInFstab(name, a, pp); } } if (changes) { CF_MOUNTALL = true; } } else { if (a.mount.unmount) { VerifyUnmount(name, a, pp); if (a.mount.editfstab) { VerifyNotInFstab(name, a, pp); } } else { cfPS(cf_inform, CF_NOP, "", pp, a, " -> Filesystem %s seems to be mounted as promised\n", name); } } free(options); return true; }
PromiseResult VerifyMount(EvalContext *ctx, char *name, const Attributes *a, const Promise *pp) { char comm[CF_BUFSIZE]; FILE *pfp; char *host, *rmountpt, *mountpt, *opts=NULL; host = a->mount.mount_server; rmountpt = a->mount.mount_source; mountpt = name; /* Check for options required for this mount - i.e., -o ro,rsize, etc. */ if (a->mount.mount_options) { opts = Rlist2String(a->mount.mount_options, ","); } else { opts = xstrdup(VMOUNTOPTS[VSYSTEMHARDCLASS]); } PromiseResult result = PROMISE_RESULT_NOOP; if (!DONTDO) { snprintf(comm, CF_BUFSIZE, "%s -o %s %s:%s %s", CommandArg0(VMOUNTCOMM[VSYSTEMHARDCLASS]), opts, host, rmountpt, mountpt); if ((pfp = cf_popen(comm, "r", true)) == NULL) { Log(LOG_LEVEL_ERR, "Failed to open pipe from '%s'", CommandArg0(VMOUNTCOMM[VSYSTEMHARDCLASS])); return PROMISE_RESULT_FAIL; } size_t line_size = CF_BUFSIZE; char *line = xmalloc(line_size); ssize_t res = CfReadLine(&line, &line_size, pfp); if (res == -1) { if (!feof(pfp)) { Log(LOG_LEVEL_ERR, "Unable to read output of mount command. (fread: %s)", GetErrorStr()); cf_pclose(pfp); free(line); return PROMISE_RESULT_FAIL; } } else if ((strstr(line, "busy")) || (strstr(line, "Busy"))) { cfPS(ctx, LOG_LEVEL_INFO, PROMISE_RESULT_INTERRUPTED, pp, a, "The device under '%s' cannot be mounted", mountpt); result = PromiseResultUpdate(result, PROMISE_RESULT_INTERRUPTED); cf_pclose(pfp); free(line); return 1; } free(line); cf_pclose(pfp); } /* Since opts is either Rlist2String or xstrdup'd, we need to always free it */ free(opts); cfPS(ctx, LOG_LEVEL_INFO, PROMISE_RESULT_CHANGE, pp, a, "Mounting '%s' to keep promise", mountpt); result = PromiseResultUpdate(result, PROMISE_RESULT_CHANGE); return result; }
int VerifyNotInFstab(EvalContext *ctx, char *name, const Attributes *a, const Promise *pp, PromiseResult *result) /* Ensure filesystem is NOT in fstab, and return no of changes */ { char regex[CF_BUFSIZE]; char *host, *mountpt, *opts; Item *ip; if (!FSTABLIST) { if (!LoadFileAsItemList(&FSTABLIST, VFSTAB[VSYSTEMHARDCLASS], a->edits)) { Log(LOG_LEVEL_ERR, "Couldn't open '%s'", VFSTAB[VSYSTEMHARDCLASS]); return false; } else { FSTAB_EDITS = 0; } } if (a->mount.mount_options) { opts = Rlist2String(a->mount.mount_options, ","); } else { opts = xstrdup(VMOUNTOPTS[VSYSTEMHARDCLASS]); } host = a->mount.mount_server; mountpt = name; if (MatchFSInFstab(mountpt)) { if (a->mount.editfstab) { #if defined(_AIX) FILE *pfp; char aixcomm[CF_BUFSIZE]; snprintf(aixcomm, CF_BUFSIZE, "/usr/sbin/rmnfsmnt -f %s", mountpt); if ((pfp = cf_popen(aixcomm, "r", true)) == NULL) { cfPS(ctx, LOG_LEVEL_ERR, PROMISE_RESULT_FAIL, pp, a, "Failed to invoke /usr/sbin/rmnfsmnt to edit fstab"); *result = PromiseResultUpdate(*result, PROMISE_RESULT_FAIL); return 0; } size_t line_size = CF_BUFSIZE; char *line = xmalloc(line_size); for (;;) { ssize_t res = getline(&line, &line_size, pfp); if (res == -1) { if (!feof(pfp)) { cfPS(ctx, LOG_LEVEL_ERR, PROMISE_RESULT_FAIL, pp, a, "Unable to read output of /bin/rmnfsmnt"); *result = PromiseResultUpdate(*result, PROMISE_RESULT_FAIL); cf_pclose(pfp); free(line); return 0; } else { break; } } if (line[0] == '#') { continue; } if (strstr(line, "busy")) { cfPS(ctx, LOG_LEVEL_INFO, PROMISE_RESULT_INTERRUPTED, pp, a, "The device under '%s' cannot be removed from '%s'", mountpt, VFSTAB[VSYSTEMHARDCLASS]); *result = PromiseResultUpdate(*result, PROMISE_RESULT_INTERRUPTED); free(line); return 0; } } free(line); cf_pclose(pfp); return 0; /* ignore internal editing for aix , always returns 0 changes */ #else Item* next; snprintf(regex, CF_BUFSIZE, ".*[\\s]+%s[\\s]+.*", mountpt); for (ip = FSTABLIST; ip != NULL; ip = next) { next = ip->next; if (FullTextMatch(ctx, regex, ip->name)) { cfPS(ctx, LOG_LEVEL_INFO, PROMISE_RESULT_CHANGE, pp, a, "Deleting file system mounted on '%s'", host); *result = PromiseResultUpdate(*result, PROMISE_RESULT_CHANGE); // Check host name matches too? DeleteThisItem(&FSTABLIST, ip); FSTAB_EDITS++; } } #endif } } if (a->mount.mount_options) { free(opts); } return 0; }
int VerifyInFstab(EvalContext *ctx, char *name, const Attributes *a, const Promise *pp, PromiseResult *result) /* Ensure filesystem IS in fstab, and return no of changes */ { assert(a != NULL); char fstab[CF_BUFSIZE]; char *host, *rmountpt, *mountpt, *fstype, *opts; if (!FSTABLIST) { if (!LoadFileAsItemList(&FSTABLIST, VFSTAB[VSYSTEMHARDCLASS], a->edits)) { Log(LOG_LEVEL_ERR, "Couldn't open '%s'", VFSTAB[VSYSTEMHARDCLASS]); return false; } else { FSTAB_EDITS = 0; } } if (a->mount.mount_options) { opts = Rlist2String(a->mount.mount_options, ","); } else { opts = xstrdup(VMOUNTOPTS[VSYSTEMHARDCLASS]); } host = a->mount.mount_server; rmountpt = a->mount.mount_source; mountpt = name; fstype = a->mount.mount_type; #if defined(__QNX__) || defined(__QNXNTO__) snprintf(fstab, CF_BUFSIZE, "%s:%s \t %s %s\t%s 0 0", host, rmountpt, mountpt, fstype, opts); #elif defined(_CRAY) char fstype_upper[CF_BUFSIZE]; strlcpy(fstype_upper, fstype, CF_BUFSIZE); ToUpperStrInplace(fstype_upper); snprintf(fstab, CF_BUFSIZE, "%s:%s \t %s %s\t%s", host, rmountpt, mountpt, fstype_upper, opts); break; #elif defined(__hpux) snprintf(fstab, CF_BUFSIZE, "%s:%s %s \t %s \t %s 0 0", host, rmountpt, mountpt, fstype, opts); #elif defined(_AIX) snprintf(fstab, CF_BUFSIZE, "%s:\n\tdev\t= %s\n\ttype\t= %s\n\tvfs\t= %s\n\tnodename\t= %s\n\tmount\t= true\n\toptions\t= %s\n\taccount\t= false\n", mountpt, rmountpt, fstype, fstype, host, opts); #elif defined(__linux__) snprintf(fstab, CF_BUFSIZE, "%s:%s \t %s \t %s \t %s", host, rmountpt, mountpt, fstype, opts); #elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD__) snprintf(fstab, CF_BUFSIZE, "%s:%s \t %s \t %s \t %s 0 0", host, rmountpt, mountpt, fstype, opts); #elif defined(__sun) || defined(sco) || defined(__SCO_DS) snprintf(fstab, CF_BUFSIZE, "%s:%s - %s %s - yes %s", host, rmountpt, mountpt, fstype, opts); #elif defined(__CYGWIN__) snprintf(fstab, CF_BUFSIZE, "/bin/mount %s:%s %s", host, rmountpt, mountpt); #endif Log(LOG_LEVEL_VERBOSE, "Verifying '%s' in '%s'", mountpt, VFSTAB[VSYSTEMHARDCLASS]); if (!MatchFSInFstab(mountpt)) { AppendItem(&FSTABLIST, fstab, NULL); FSTAB_EDITS++; cfPS(ctx, LOG_LEVEL_INFO, PROMISE_RESULT_CHANGE, pp, a, "Adding file system '%s:%s' to '%s'", host, rmountpt, VFSTAB[VSYSTEMHARDCLASS]); *result = PromiseResultUpdate(*result, PROMISE_RESULT_CHANGE); } free(opts); return 0; }