| 212 | |
| 213 | #ifndef NO_NFS |
| 214 | bool ISC_analyze_nfs(tstring& expanded_filename, tstring& node_name) |
| 215 | { |
| 216 | /************************************** |
| 217 | * |
| 218 | * I S C _ a n a l y z e _ n f s |
| 219 | * |
| 220 | ************************************** |
| 221 | * |
| 222 | * Functional description |
| 223 | * Check a file name for an NFS mount point. If so, |
| 224 | * decompose into node name and remote file name. |
| 225 | * |
| 226 | **************************************/ |
| 227 | |
| 228 | // If we are ignoring NFS remote mounts then do not bother checking here |
| 229 | // and pretend it's only local. MOD 16-Nov-2002 |
| 230 | |
| 231 | if (Config::getRemoteFileOpenAbility()) |
| 232 | return false; |
| 233 | |
| 234 | #ifdef LINUX |
| 235 | // In order to avoid analyzing mtab in most cases check for non-device mounts first |
| 236 | struct stat fileStat; |
| 237 | unsigned m = 1; // use something that is known to be not non-device major |
| 238 | |
| 239 | if (os_utils::stat(expanded_filename.c_str(), &fileStat) == 0) |
| 240 | m = major(fileStat.st_dev); |
| 241 | else // stat error - let's try with path component |
| 242 | { |
| 243 | tstring path, name; |
| 244 | PathUtils::splitLastComponent(path, name, expanded_filename); |
| 245 | |
| 246 | if (path.hasData() && os_utils::stat(path.c_str(), &fileStat) == 0) |
| 247 | m = major(fileStat.st_dev); |
| 248 | } |
| 249 | |
| 250 | if (m != 0 && m != 144 && m != 145 && m != 146) |
| 251 | { |
| 252 | // device mount or stat for file/path is impossible - definitely not NFS |
| 253 | return false; |
| 254 | } |
| 255 | |
| 256 | // proceed with deeper analysis |
| 257 | #endif |
| 258 | |
| 259 | tstring max_node, max_path; |
| 260 | size_t len = 0; |
| 261 | |
| 262 | // Search mount points |
| 263 | Mnt mount; |
| 264 | if (!mount.ok()) |
| 265 | { |
| 266 | return false; |
| 267 | } |
| 268 | |
| 269 | while (mount.get()) |
| 270 | { |
| 271 | tstring node, path; |