euca_file.c (eucalyptus-4.4.1) | : | euca_file.c (eucalyptus-4.4.2) | ||
---|---|---|---|---|
skipping to change at line 1126 | skipping to change at line 1126 | |||
return (ret); | return (ret); | |||
} | } | |||
//! | //! | |||
//! ensure the temp file is only readable by the user | //! ensure the temp file is only readable by the user | |||
//! | //! | |||
//! @param[in] template | //! @param[in] template | |||
//! | //! | |||
//! @return -1 on failure or the corresponding files descriptor for the temp fil e | //! @return -1 on failure or the corresponding files descriptor for the temp fil e | |||
//! | //! | |||
char *safe_mkdtemp(char *template) | ||||
{ | ||||
mode_t u = 0; | ||||
char *ret = NULL; | ||||
u = umask(0077); | ||||
ret = mkdtemp(template); | ||||
umask(u); | ||||
return (ret); | ||||
} | ||||
//! | ||||
//! ensure the temp file is only readable by the user | ||||
//! | ||||
//! @param[in] template | ||||
//! | ||||
//! @return -1 on failure or the corresponding files descriptor for the temp fil | ||||
e | ||||
//! | ||||
int safe_mkstemp(char *template) | int safe_mkstemp(char *template) | |||
{ | { | |||
mode_t u = 0; | ||||
int ret = 0; | int ret = 0; | |||
u = umask(0077); | ||||
ret = mkstemp(template); | ret = mkstemp(template); | |||
umask(u); | ||||
return (ret); | return (ret); | |||
} | } | |||
End of changes. 4 change blocks. | ||||
23 lines changed or deleted | 0 lines changed or added |