#include <time.h>
#include <utime.h>
#include <sys/stat.h>
+#include <sys/param.h>
#include <fcntl.h>
#include <sys/statvfs.h>
ldout(cct, 10) << "path_walk " << path << dendl;
- set<Inode*,Inode::Compare> visited;
+ int symlinks = 0;
+
unsigned i=0;
while (i < path.depth() && cur) {
const string &dname = path[i];
// only follow trailing symlink if followsym. always follow
// 'directory' symlinks.
if (next && next->is_symlink()) {
- ldout(cct, 20) << " symlink value is '" << next->symlink << "'" << dendl;
- if (i < path.depth() - 1) {
- // check for loops
- if (visited.find(next) != visited.end()) {
- // already hit this one, return error
- return -ELOOP;
- }
- visited.insert(next);
+ symlinks++;
+ ldout(cct, 20) << " symlink count " << symlinks << ", value is '" << next->symlink << "'" << dendl;
+ if (symlinks > MAXSYMLINKS) {
+ return -ELOOP;
+ }
+ if (i < path.depth() - 1) {
// dir symlink
// replace consumed components of path with symlink dir target
filepath resolved(next->symlink.c_str());