libsmbclient ライブラリを使用して、Windows 7/XP SMB 共有でリモート ホストの fs 構造を監視しようとしています。そのようなコード:
bool open(QList<DirType> &resList){
SMBCFILE* dh = smbc_getFunctionOpendir(ctx)(ctx,rootpath.toLocal8Bit());
if (dh==NULL) return false;
smbc_dirent *res;
bool isitZeroLevel = false;
while (res=smbc_getFunctionReaddir(ctx)(ctx,dh)){
if (res->smbc_type==SMBC_FILE_SHARE) isitZeroLevel=true;
struct stat aboutres;
smbc_getFunctionStat(ctx)(ctx,(rootpath+"/"+smb_name).toLocal8Bit(),
&aboutres);
DirType d(res->smbc_type,res->name,aboutres.st_mtim.tv_sec);
resList.push_back(d);
}
smbc_getFunctionClosedir(ctx)(ctx,dh);
if(isitZeroLevel){
smbc_setOptionOneSharePerServer(ctx,1);
close();
}
return true;
}
このコードは、サーバー上のすべてのディレクトリに対して再帰的に呼び出され、私の Samba サーバーでは正常に動作します。しかし、Windows はある時点で接続を拒否します。Windows では接続に制限があり、smbclient では制限が多すぎると思います。(samba-3.5.15 を使用して linux-3.4.9 で実行)