使用 perl 和 webdav 访问共享点 [英] Accessing a sharepoint using perl and webdav

查看:14
本文介绍了使用 perl 和 webdav 访问共享点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题 494120,但恕我直言并没有真正回答...

a similar question was asked in question 494120, but IMHO was not really answered...

我想使用 perl/WebDAV(来自 Win32 主机)将文件上传到共享点.为了实现这一点,我需要在服务器上使用 KERBEROS 进行身份验证.在谷歌搜索数小时并尝试不同的方法后,我无法打开连接.当前代码是这样的:

I want to upload files to a sharepoint using perl/WebDAV (from a Win32 host). To achive this, I need to authenticate with KERBEROS on the server. After googling for hours and trying different approaches, I'm not able to open a connection. Current code is this:

my $agent = HTTP::DAV::UserAgent->new(keep_alive=>1);  
$agent->agent('Agent');  
$agent->timeout(1000);  
my $d = HTTP::DAV->new(-useragent => $agent);  
$d->credentials( -user=>$user,-pass =>$pass, -url =>$url);  
$d->open( -url=>$url ) or die("Couldn't open $url: " .$d->message . "
");  

在执行 $d->open(...) 时,我总是收到无法打开 $url:未经授权.协商".因此,显然基本身份验证不起作用.

When doing the $d->open(...), I always get "Couldn't open $url: Unauthorized. Negotiate". So, obviously the basic authentication doesn't work.

有人能指出我正确的道路吗?我并不固定使用 WebDAV,任何其他机制也适合我.只是想让它工作......

Could anyone point me to the right path, please? I am not fixed to using WebDAV, any other mechanism would fit me as well. Just want to get it working...

编辑 1
LWPAuthen::NTLM 一起使用时(如 Madhur) 也不起作用.它会在 IIS 和 Apache 上导致 500 内部服务器错误.由于相同的错误发生在两个不同的 Web 服务器(具有两个不同的 NTLM 实现)上,我想 Authen::NTLM 模块中一定有问题.

Edit 1
When using LWP along with Authen::NTLM (as suggested by Madhur) also doesn't work. It results in a 500 internal server error on IIS as well as on Apache. Since the same error occurs on two different web servers (with two different NTLM implementations) I guess that there's gotta be a problem in the Authen::NTLM module.

Authen的实现::NTLM 在我看来,代码有点逆向工程,既不是基于规范实现的,也不是真正可配置的.为什么规范没有用于实现模块的问题是什么?...

Looking at the implementation of Authen::NTLM it seems to me that the code is kinda reverse engineered and neither implemented based on a specification nor is it really configurable. What turns up the question why the specification wasn't used to implement the module...

将 NTLM 与 Perl 一起使用是一种奇特的用例吗?

Is using NTLM along with Perl such an exotic use case?

编辑 2
根据 Madhur 的建议,我尝试使用 Curl 访问 Sharepoint.这有效.但是通过嗅探 Curl 的 NTLM 消息和 Perl 发送的消息,我发现消息格式有些不同.

Edit 2
Based on Madhur's suggestion, I tried accessing the Sharepoint with Curl. This works. But sniffing the NTLM messages of Curl and those sent by Perl shows me, that the message format is somehow different.

推荐答案

而不是使用 WebDAV.我建议您使用开箱即用的网络服务.

Instead of using WebDAV. I would suggest you use out of the box web services.

这里概述了如何在 PERL 中使用 sharepoint 网络服务:

This gives overview on how to use sharepoint web services in PERL:

http://www.squish.net/log/2008/10/11/perl-sharepoint/

http://shareperl.blogspot.com/

这是使用 Web 服务上传文件的 .NET 代码:http://www.oriolardevol.com/Article/Details/3

And this is the .NET code to upload the file using web service: http://www.oriolardevol.com/Article/Details/3

自从我使用 PERL 以来已经好几年了,将其转换为 PERL 代码由您决定:)

Converting it to PERL code is left to you as its been years since I used PERL :)

这篇关于使用 perl 和 webdav 访问共享点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆