发现 liboauth 的一个 bug:FUSE 下 oauth_gen_nonce() 结果异常

转载时请注明出处和作者联系方式:http://blog.csdn.net/mimepp
作者联系方式:YU TAO <yut616 at sohu dot com>

关键字: linux,fuse, liboauth,oauth_gen_nonce,oauth_sign_hmac_sha1

这里记录一下遇到的一个 liboauth 结果异常的情况。

例子代码:

http://www.kuaipan.com.cn/file/id_12177787062321391.htm

Error log:
=========================
open_src/fuse_oauth$ make
Compiling hello.c
Building  hello
test/fuse_oauth$ mkdir /tmp/aaa
test/fuse_oauth$ ./hello /tmp/aaa/
test/fuse_oauth$ cat /tmp/aaa/hello
5555555555555555555555
test/fuse_oauth$
test/fuse_oauth$ cat /tmp/aaa/hello
5555555555555555555555
test/fuse_oauth$
test/fuse_oauth$
=========================

but if I remark line 138 (hello.c), which is a call in main function, the result will be correct:
    //oauth_nonce = oauth_gen_nonce();
=========================
test/fuse_oauth$ fusermount -u /tmp/aaa
test/fuse_oauth$ ./hello /tmp/aaa/
test/fuse_oauth$ cat /tmp/aaa/hello
e3BJGRSUFWBXeRF
test/fuse_oauth$
test/fuse_oauth$
test/fuse_oauth$
test/fuse_oauth$ cat /tmp/aaa/hello
EFJuwuxEvWNlJvO4f5nxBTg
=========================

PC: ubuntu 11.10
liboauth-0.9.4
liboauth-dev is installed by apt-get.
It will depends on libcurl4-nss-dev.
I do not compile liboauth by myself.

It seems liboauth is using openssl:
src/config.h:
#define HAVE_OPENSSL_HMAC_H 1
and the USE_NSS is not defined.
Then it will enter line 538:
src/oauth.c
=========================
#  include <openssl/rand.h>
#  define MY_RAND RAND_bytes
#  define MY_SRAND ;
=========================

BTW, auth_signature is NULL too.
http://openapi.kuaipan.cn/1/metadata/kuaipan/UML?oauth_consumer_key=xc8D2NfL9c53vkrP&oauth_nonce=aaaaaaaaaaaaaaa&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1332589513&oauth_token=32a7d5efb0d5442e8e32c6d7518e8239&oauth_version=1.0&oauth_signature=%28null%29

It seems nonce and signature are related to openssl.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值